Skip to content

Instantly share code, notes, and snippets.

View tuanmai's full-sized avatar
🎯
Focusing

Tuan Mai tuanmai

🎯
Focusing
View GitHub Profile
heroku config:set BUILDPACK_URL='git://github.com/qnyp/heroku-buildpack-ruby-bower.git#run-bower'
#https://github.com/qnyp/heroku-buildpack-ruby-bower/wiki
heroku buildpacks:set https://github.com/qnyp/heroku-buildpack-ruby-bower.git#run-bower
@tuanmai
tuanmai / gist:5caaae7df3454259ee2aa502f79a2431
Created April 27, 2016 14:51 — forked from afeld/gist:5704079
Using Rails+Bower on Heroku
@tuanmai
tuanmai / nginx.conf
Created May 6, 2016 03:44 — forked from baskaran-md/nginx.conf
NginX allow POST on static pages.
# ...
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
@tuanmai
tuanmai / branch-fu.md
Created June 15, 2016 16:41 — forked from unbracketed/branch-fu.md
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
grep -A 5
-B, --before-context=NUM print NUM lines of leading context
-A, --after-context=NUM print NUM lines of trailing context
-C, --context=NUM print NUM lines of output context
lsof -nP +c 15 | grep LISTEN
```
com.docker.slir 1676 tuanmai 19u IPv4 0x833f33a136ee0815 0t0 TCP *:10871 (LISTEN)
com.docker.slir 1676 tuanmai 21u IPv6 0x833f33a13723fb95 0t0 TCP [::1]:10871 (LISTEN)
com.docker.slir 1676 tuanmai 23u IPv4 0x833f33a13a3c8435 0t0 TCP *:32773 (LISTEN)
com.docker.slir 1676 tuanmai 25u IPv6 0x833f33a136b18b75 0t0 TCP [::1]:32773 (LISTEN)
com.docker.slir 1676 tuanmai 26u IPv4 0x833f33a136f55435 0t0 TCP *:5431 (LISTEN)
com.docker.slir 1676 tuanmai 27u IPv6 0x833f33a12d071615 0t0 TCP [::1]:5431 (LISTEN)
com.docker.slir 1676 tuanmai 29u IPv4 0x833f33a136bdea05 0t0 TCP *:3000 (LISTEN)
```
Type man tar for more information, but this command should do the trick:
tar -xvzf community_images.tar.gz
To explain a little further, tar collected all the files into one package, community_images.tar. The gzip program applied compression, hence the gz extension. So the command does a couple things:
f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.
z: tells tar to decompress the archive using gzip
x: tar can collect files or extract them. x does the latter.
v: makes tar talk a lot. Verbose output shows you all the files being extracted.
$$('.file-header button').forEach(function(element){element.click()})
import React, { PureComponent } from 'react';
import { View, Animated, Dimensions, Platform } from 'react-native';
import Interactable from 'react-native-interactable';
import { compose, mapProps } from 'recompose';
const { width } = Dimensions.get('window');
/* eslint-disable */
/*
* Origin state
@tuanmai
tuanmai / gist:f524aff20b424bf9f5d735ef3951f5c8
Last active July 19, 2019 03:01 — forked from bessarabov/gist:674ea13c77fc8128f24b5e3f53b7f094
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Tuan Mai" --date=iso | perl -nalE 'if (/[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'