Skip to content

Instantly share code, notes, and snippets.

View leoapost's full-sized avatar

Leonidas Apostolidis leoapost

View GitHub Profile

Keybase proof

I hereby claim:

  • I am leoapost on github.
  • I am leoapost (https://keybase.io/leoapost) on keybase.
  • I have a public key ASBFgeJ-mTYXWeN0X_zipwe51YhNfpPdlaCBOHX0zFPdCwo

To claim this, I am signing this object:

@leoapost
leoapost / ca.md
Created September 13, 2018 14:32 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

@leoapost
leoapost / web-servers.md
Created July 24, 2017 11:57 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@leoapost
leoapost / latency.txt
Created January 29, 2017 19:15 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@leoapost
leoapost / gist:4318441
Created December 17, 2012 13:55
Delete all remote branches, except master
# Replace REMOTE_NAME with your remote name (e.g. origin)
git branch -r | grep REMOTE_NAME/ | grep -v 'master$' | grep -v HEAD| cut -d/ -f2 | while read line; do git push REMOTE_NAME :$line; done;
@leoapost
leoapost / gist:4318392
Last active December 9, 2015 19:38
Search for a keyword in every file that has been changed in the last 20 commits of a specific author
# Replace AUTHOR_NAME with the author's name
# Replace KEYWORD with the keyword you wanna find
for x in $(git log --author=AUTHOR_NAME --pretty=format:'%h' -n 20 | cut -d" " -f1) ; do for y in $(git show --pretty="format:" --name-only $x) ; do if [ -f $y ]; then echo $y ; grep -in 'KEYWORD' $y ; fi ; done ; done
@leoapost
leoapost / gist:4318379
Created December 17, 2012 13:45
Search for a keyword in all commit affected files
# Replace KEYWORD with the keyword you wanna find
# Replace COMMIT_HASH with the actual hash (e.g. 2005b934aaad9b481f8966e618dabfc143ab8357)
for x in $(git show --pretty="format:" --name-only COMMIT_HASH) ; do if [ -f $x ]; then echo $x ; grep -in 'KEYWORD' $x ; fi ; done