Skip to content
/ TIL Public
forked from beatobongco/TIL

Always be improving. A small list of shit I learned.

Notifications You must be signed in to change notification settings

kevinwkc/TIL

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

TIL

A small list of shit I learned.

Some of my talks and presentations can be found here.

I love to read. Here are some book recommendations and my reading list.

I'm glad to be of service if someone finds these useful :)

9/21/2017

9/19/2017

9/15/2017

  • “Scientists generally agree that no theory is 100 percent correct. Thus, the real test of knowledge is not truth, but utility.” - Noah Harari
  • You have to build out your toolbox. Thus, the secret to great thinking is to learn and employ a variety of mental models.
  • World-class thinkers are often silo-free thinkers. They avoid looking at life through the lens of one subject. Instead, they develop “liquid knowledge” that flows easily from one topic to the next.
  • http://jamesclear.com/feynman-mental-models
  • Get that pesky 1600x900 resolution on Gnome http://ubuntuhandbook.org/index.php/2017/04/custom-screen-resolution-ubuntu-desktop/

9/13/2017

9/11/2017

9/9/2017

9/6/2017

9/4/2017

  • Function programming http://www.lihaoyi.com/post/WhatsFunctionalProgrammingAllAbout.html
  • Having a macro view is essential. Don't miss the forest for the trees, but do understand the intricacies of the trees so you can better navigate the forest.
  • js this is not an author-time binding but a runtime binding. It is contextual based on the conditions of the function's invocation. this binding has nothing to do with where a function is declared, but has instead everything to do with the manner in which the function is called.
  • this is neither a reference to the function itself, nor is it a reference to the function's lexical scope.

9/2/2017

8/31/2017

8/30/2017

8/29/2017

8/28/2017

  • Revealing Module pattern in JS is like a public API for a module. https://github.com/getify/You-Dont-Know-JS/blob/master/scope%20%26%20closures/ch5.md
  • Closures (in my own words, not necessarily accurate) are just that functions retain memory/reference (?) of variables defined at the same scope level.
  • Defined in the book: Closure is when a function can remember and access its lexical scope even when it's invoked outside its lexical scope.
  • A useful memory aid for this is:
function Monster(name) {
  var life = 100;

  function takeDamage(n) {
    life -= n
  }

  function showHP() {
    console.log(name + ' has ' + life + ' HP.')
  }

  return {
    takeDamage: takeDamage,
    showHP: showHP
  }
}

var bakemono = Monster('Poring')
var bakemono2 = Monster('Poporing')

bakemono.takeDamage(10)
bakemono.showHP() // Poring has 90 HP.

// note that bakemono2 is not affected
bakemono2.showHP() // Poporing has 100 HP.

8/22/2017

  • Writing stuff out may be important for learning because our hands command one of the largest provisions of our brains based on the cortical homonculus. Notice hands are allocated greater resources than both the eyes and ears.
  • YDKJS book 2, chapter 3: Use immediately invoked function expressions (IIFE's) to keep your global scope clean. (function a() { console.log(1) })()

8/17/2017

8/2/2017

7/30/2017

7/25/2017

7/12/2017

7/11/2017

7/10/2017

  • People who take breaks and have leisure time outperform those who only just doggedly pursue an endless treadmill - Learning How to Learn

7/9/2017

6/30/2017

6/29/2017

6/28/2017

  • Create env in conda conda create -n tensorflow python=<ver>, source activate tensorflow
  • Silence tf errors, or build from source
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
import tensorflow as tf

6/26/2017

image

6/24/2017

6/22/2017

  • See partitions and where they're mounted sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL
  • Sounds intuitive. Clear cached images and files if Chrome is not honoring your hosts file.

6/21/2017

my_config = {'verbose': sys.stderr}
requests.get('http://httpbin.org/headers', config=my_config)

6/20/2017

6/19/2017

6/18/2017

6/16/2017

  • Having wifi probs on Ubuntu? Try sudo killall dnsmasq

6/15/2017

6/14/2017

6/8/2017

6/6/2017

6/5/2017

  • Reads open source non-fiction books and gives me the keywords. Produces a super short high-frequency non-stupid words (Can use classifier and tweak) summary so I can choose something to skim. e.g. Steve Jobs - biography - Apple billion dollar company, Elon Musk - biography Tesla Space X solar electric
  • Theoretically, could you build a machine designed to be more efficient and make it run a deep learning algorithm to recursively improve its own efficiency?

6/3/2017

But is what we get from the computational universe art? When we pick out something like rule 30 for a particular purpose, what we’re doing is conceptually a bit like photography: we’re not creating the underlying forms, but we are selecting the ones we choose to use.

6/1/2017

  • How to place multiple cursors on sublime text
Select all the text: CTRL A.
Activate multi-cursors: CTRL (or CMD on Mac) SHIFT L.
Press the Home key to move all cursors to the front of the line.

5/31/2017

5/25/2017

  • Delete docker logs truncate -s 0 /var/lib/docker/containers/*/*-json.log
  • Very powerful custom directives in Vue https://vuejs.org/v2/guide/custom-directive.html
  • Super funny I've never used v-show for conditional rendering in Vue. Use this to not destroy and create elements when rendering conditionally.

5/23/2017

5/22/2017

5/19/2017

5/11/2017

5/4/2017

5/3/2017

5/2/2017

4/25/2017

4/24/2017

4/19/2017

4/18/2017

4/11/2017

4/10/2017

4/6/2017

4/4/2017

3/25/2017

  • export environment variables from file
set -o allexport
source .env
set +o allexport

3/24/2017

3/23/2017

3/22/2017

3/17/2017

3/15/2017

3/14/2017

3/13/2017

  • Greedy algorithms are basically: 1. sort via a metric, 2. get the top ranking ones that fit into constraints
  • mysql can be bound to address. Just edit /etc/mysql/my.cnf look for bind-address
  • When creating mysql users, you can define from which hosts they can connect

3/10/2017

  • Giving someone ssh access, just add to ~/.ssh/authorized_keys

3/8/2017

3/7/2017

3/4/2017

3/3/2017

  • Careful what you type in terminal. history | grep

2/27/2017

2/26/2017

2/25/2017

2/23/2017

2/20/2017

2/18/2017

2/17/2017

  • Useful sublime shortcuts
  • ctrl+p go to filename in proj
  • ctrl+r go to symbol etc in file
  • ctrl+p <filename> @ go to file then to symbol, etc
  • ctrl+g go to line number
  • ctrl+alt+p switch project
  • alt+shift+[1..4] number of columns
  • ctrl+w close a file
  • ctrl+enter add newline after this one
  • ctrl+ [ or ] un/indent lines

2/16/2017

2/15/2017

2/13/2017

2/10/2017

2/9/2017

2/8/2017

2/7/2017

  • Get updated with master easily! git fetch origin master git rebase origin/master
  • git clean -f remove new uncommitted files

1/31/2017

1/29/2017

  • Upload image, choose paint, it will color for you. Machine learning!! http://paintschainer.preferred.tech/
    L1 = [1, 28, 36]
    L2 = [2, 57, 9]
    for x in map(min, L1, L2):
      print(x)
    //output: [1, 28, 9]
    

1/25/2017

1/24/2017

1/18/2017

1/13/2017

1/11/2017

1/7/2017

1/4/2017

1/2/2017

12/25/2016

12/22/2016

12/21/2016

12/20/2016

12/16/2016

12/14/2016

12/8/2016

12/8/2016

  • I want to learn how to create miniamlist assets of my own, ala flaticons. https://www.gimp.org/tutorials/Creating_Icons/
  • How to ship side projects http://blog.andyjiang.com/how-to-ship-side-projects/
  • Idea: CRUD-tacular. A template for extremely quick client-side-only app with user management on localforage. Kinda like a superwireframe to test concepts quickly. Not meant for real app building. Bonus if you can make data persist somehow. Includes forms and viewing of forms.
  • AESOP - A picture book blog thing like the nytimes sometimes posts that allows mobile scrolling and fading in and out of pictures that remain centered. PRIORITY

12/6/2016

12/5/2016

12/2/2016

12/1/2016

11/29/2016

  • TIL: When using redis from a docker image (or redis in general actually) remember to do the following on the host server...

    • set the Linux kernel overcommit memory setting to 1 by sysctl vm.overcommit_memory=1 and adding vm.overcommit_memory = 1 to /etc/sysctl.conf. The default is 0. Redis background save may fail under low memory condition. (This is what I assume the original problem was about)
    • Increase max connections so a TCP setting can be enforced. Set sysctl net.core.somaxconn=65535 and add ti sysctl.conf
    • Disable Transparent Huge Pages (THP). If enabled (by default) this will create latency and memory usage issues with Redis. Run echo never > /sys/kernel/mm/transparent_hugepage/enabled.
  • Lessons for the future perhaps https://www.technologyreview.com/s/602961/four-lessons-for-silicon-valley-from-its-first-startup/?utm_campaign=socialflow&utm_source=facebook&utm_medium=post

  • git diff --cached <filename> see changes of file

11/21/2016

11/15/2016

11/14/2016

11/10/2016

11/1/2016

10/31/2016

10/30/2016

10/29/2016

10/24/2016

10/23/2016

10/18/2016

10/16/2016

10/15/2016

10/12/2016

10/6/2016

10/5/2016

9/9/2016

  • To remove directories, run git clean -f -d or git clean -fd.

9/2/2016

  • In Chrome dev console, one can highlight an element and type in console $1 to reference that element and do shit to it.

8/26/2016

8/18/2016

8/4/2016

7/29/2016

7/18/2016

7/7/2016

7/5/2016

6/28/2016

6/27/2016

6/22/2016

6/20/2016

6/7/2016

6/3/2016

6/1/2016

5/31/2016

5/25/2016

5/18/2016

5/17/2016

5/10/2016

  • Clean way of preloading via CSS only
#preload {
  background: url(../img/move.gif) no-repeat -9999px -9999px;
}

5/5/2016

5/4/2016

5/2/2016

  • CSS: The ~ combinator separates two selectors and matches the second element only if it is preceded by the first, and both share a common parent.

4/25/2016

4/13/2016

  • Messeger platform - bots for facebook https://messengerplatform.fb.com/
  • Wit AI Natural language for devs https://wit.ai/
  • /usr/bin/env: node: No such file or directory FIX ln -s /usr/bin/nodejs /usr/bin/node
  • flex: none; This is equivalent to flex: 0 0 auto. It sizes the item according to its width/height properties, but makes it fully inflexible. This is similar to flex: initial except it is not allowed to shrink, even in an overflow situation. Super useful for divs with no content and background image. https://css-tricks.com/almanac/properties/f/flex/#article-header-id-4
  • TODO: Make a tutorial for flex. Remember: display: flex;, flex: 1, overflow: auto or hidden; are your 3 key css properties to modify to get awesome scaling apps.

4/6/2016

4/2/2016

3/29/2016

3/25/2016

3/20/2016

3/17/2016

3/16/2016

3/9/2016

3/8/2016

  • capture the screen, face, voice and all the touches/clicks on a device, and then automatically upload it to your dashboard for you to view, collaborate, and share. https://lookback.io/

3/3/2016

3/2/2016

3/1/2016

2/26/2016

2/25/2016

2/22/2016

  • argv in python gets args after running script like script_name, arg1, arg2, arg3 = argv python script.py blah blah blah
  • Probability dipstributions see 2016-2-22.md

2/19/2016

2/16/2016

2/10/2016

2/7/2016

2/4/2016

2/3/2016

2/1/2016

1/27/2016

1/26/2016

1/21/2016

1/20/2016

1/18/2016

1/14/2016

12/10/2015

12/7/2015

  • kill %1 kill first job put in bg. Super useful for killing simpleHTTPservers that exit wrong.

12/6/2015

12/3/2015

11/30/2015

11/25/2015

11/23/2015

11/18/2015

11/12/2015

11/11/2015

10/16/2015

10/9/2015

  • copy from docker container to host docker cp :/file/path/within/container /host/path/target

10/2/2015

9/24/2015

9/18/2015

  • Don't forget to add gzip types to Nginx make site faster esp for React! gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/javascript text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
  • f(**args) Python unpack arguments splat https://docs.python.org/2/tutorial/controlflow.html#unpacking-argument-lists

9/16/2015

  • beautiful hover animations http://ianlunn.github.io/Hover/
  • remove filter while scaling CSS3 animations -webkit-filter: blur(0); -ms-filter: blur(0); filter: blur(0);

9/7/2015

9/2/2015

9/1/2015

  • Configure server time dpkg-reconfigure tzdata

8/30/2015

8/27/2015

  • If you get weird content mismatch errors, try making sure that time on both your server/virtual machine and host is the same.

8/16/2015

8/12/2015

  • https://github.com/seatgeek/fuzzywuzzy fuzzy search
  • Get all tags, put in choices array
  • >>> choices = ["Atlanta Falcons", "New York Jets", "New York Giants", "Dallas Cowboys"]
  • >>> process.extract("new york jets", choices, limit=2)
  • [('New York Jets', 100), ('New York Giants', 78)]
  • mock data https://www.mockaroo.com/

8/11/2015

8/10/2015

7/23/2015

7/21/2015:

  • If serving on nginx during development, don't forget to add 127.0.0.1 www.something.com to your hosts file in C:\Windows\System32\drivers\etc

7/18/2015

7/16/2015

7/15/2015

7/14/2015

  • Reset git to remote: git fetch origin && git reset --hard origin/master

7/9/2015

7/7/2016

7/1/2015

6/30/2015

6/29/2015

6/26/2015

6/25/2015

6/22/2015

6/17/2015

6/16/2015

5/28/2015

5/22/2015

5/21/2015

  • You Suck At Photoshop -> WATCH IT YOU FUCKING NEED ITTTTT
  • Content-aware shit or "how to fill in the blanks" Use case: making a perfect square Instagram image from a landscape one
    • step 1: resize canvas
    • step 2: look for parts in photo that could be extended (like iron man's rope)
    • step 3: move the photo there
    • step 4: select empty space that was left
    • step 5: press DELETE or right click on the selection
    • step 6: press fill
    • step 7: select content-aware
    • step 8: wtf???? profit!!!

5/20/2015

5/19/2015

  • Beautiful icons http://bitshadow.github.io/iconate/
  • TIL a downfall for using shortcircuits e.g. var x = myVal1 || myVal2 because if myVal1 = 0 and you DO want to get 0, you will get myVal2 instead.
  • https://webmaker.org/en-US/tools <-- awesome shit for beginners!
  • Joseph Campbell's hero with a thousand faces... "Full circle we come, from the tomb of the womb to the womb of the tomb, a brief enigmatic journey into the realm of the solid world, only to melt away like the substance of a dream."

5/18/2015

5/12/2015

  • REACT: You can pass children as props to DOM elements. ex. <Dialog children=(<p>Yolo</p>) />

5/6/2015

  • Here is an example on how to clean up old containers that are weeks old. docker ps -a | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm
  • docker machine allows you to access your docker containers in remote places like Digital Ocean. Just do $(docker-machine env <name>) and do docker operations as normal
  • You can ssh into a docker machine like so: docker-machine ssh radar
  • using scp: Copy the file "foobar.txt" from a remote host to the local host $ scp [email protected]:foobar.txt /some/local/directory Copy the file "foobar.txt" from the local host to a remote host $ scp foobar.txt [email protected]:/some/remote/directory
  • using scp in docker-machine scp -i ~/.docker/machine/machines/radar/id_rsa dump.sql.gz root@$(docker-machine ip radar):~ Explanation: copy a file from your docker machine without logging on to said machine using ssh keys. scp -i <identity file/rsa id path> <from file path host:filepath> <to file path host:filepath>

5/1/2015

  • set a key of an object in one line in ES6 [`${prop}`]: value
  • JS: study .bind and .apply
  • React convention of expansions, always expand before passing new props so you can override <div {...this.props}

4/30/2015

  • document.getElementById('youridhere').scrollIntoView(); one line, no third party, xbrowser
  • Add methods to "classes" in JS by var x = new Class(); x.newMethod = function(x) { ... }
  • Email length in db is best limited to 320 characters
  • Remove useless docker images docker rmi $(docker images -f 'dangling=true' -q)

4/28/2015

4/22/2015

  • https://www.youtube.com/watch?v=vtJ0C0UHFfE Peter Thiel: What's the valuation of your company? Think of the valuation not as a premium on the past but a discount to the future. The way one should pitch the value of the company by explaining why it will be worth much more in the future so investors will be getting in at a point much cheaper than 1 or 2 years later.
  • Cofounder equity calculator: http://foundrs.com/

4/20/2015

4/18/2015

4/17/2015

  • press t in github -> quick repo search
  • docker cp {CONTAINER}:{PATH} {HOSTDIR} ex docker cp 59244e24ab80:/usr/local/mysql/radar.sql /home/beato/Desktop/sqlbackup

4/15/2015

4/9/2015

4/8/2015

  • docker-compose up --no-deps <container name> - Using docker, if you have images of a database don't keep on using docker-compose up db. It might cause weird shit to happen to your database. Instead for example, if you have images: web and db do docker-compose up --no-deps web to put web up but not disturb your db.

  • Aliases - aliases are a cool way to make your life easier. Edit ~/.bashrc with your favorite text editor and make shorcuts like alias dcp='docker-compose' to type in dcp instead of docker-compose

  • Restoring a dockerized database from a local .sql file

    • cd to where your .sql file is located
    • Mount your pwd inside the db container docker run --rm -ti -v `pwd`:<where you want to place shit> --link <db container>:db postgres bash
    • Go to path where sql file is and gunzip
    • Finally psql -hdb -U <username> -W < backup.sql
  • Run a docker container docker-compose run --rm <container> <cmd>

About

Always be improving. A small list of shit I learned.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 94.6%
  • JavaScript 3.0%
  • CSS 2.4%