Skip to content

Instantly share code, notes, and snippets.

View linktohack's full-sized avatar

Quang-Linh LE linktohack

View GitHub Profile
@linktohack
linktohack / subr
Created January 16, 2015 10:34
Download rmate as subr (and subl if not exist)
#!/bin/bash
wget -O /usr/local/bin/subr https://raw.githubusercontent.com/aurora/rmate/master/rmate
chmod +x /usr/local/bin/subr
if ! which subl 2>&1 > /dev/null; then
ln -s /usr/local/bin/subr /usr/local/bin/subl
fi
@linktohack
linktohack / hackerWeb.js
Last active August 29, 2015 14:14
HackerWeb (bookmarklet) redirect for HackerNews frontend
javascript:(function hackerWeb (len) {
if (window.location.href.match('https://news.ycombinator.com')) {
window.location.href = window.location.href.replace('https://news.ycombinator.com/item?id=', 'http://cheeaun.github.io/hackerweb/#/item/');
} else {
var a = document.querySelectorAll('a');
if (len != a.length) {
Array.prototype.forEach.call(a, function(e) {
var href = e.getAttribute('href');
href && e.setAttribute('href', href.replace('https://news.ycombinator.com/item?id=', 'http://cheeaun.github.io/hackerweb/#/item/'));
});
@linktohack
linktohack / gender.txt
Last active August 29, 2015 14:15
Hao gender equality
Emma Watson seems nervous at first, but I can see coherence in her speech. She starts with her own experience with her family, her school then her confession of a feminist with her male friend then to a bigger picture: Human rights, where people, men an women perceive the same rights, same opportunities in their life.
As she stated in her speech, no country at the moment achieves gender equality and it doesn't seem to change much from the talk of Hilary Clinton in 1997. She also mentions that it maybe due to the fact that there was too few men who participate the campaigns.
Having a look on the map of HeForShe, I found however, the more men's votes in US and Europe, the less votes on Africa. Is this the answer why do we have Angela Merkel as Chancellor of Germany or Marissa Mayer as CEO of Yahoo! when here are many women out there doing the job no men do in Jordan or even having no ID card in Guatemala?
@linktohack
linktohack / fortran-ampersand.el
Last active August 29, 2015 14:15
fortran insert continuation symbol (ampersand &) that match both fixed and free format.
(defun fortran-insert-f90-continuation ()
"Insert continuation symbol (ampersand &) that match both fixed and
free format.
If the inserted ampersand is the first non-blank character, just
insert it, otherwise, insert it at column 72 (zero-based index)
and insert another ampersand at column 6 on next line.
Also indent next line if `electric-indent-mode` is on."
(interactive)
@linktohack
linktohack / zshrc
Last active August 29, 2015 14:16
tor and socks proxy alias for OS X
function t () {
INTERFACE=Wi-Fi
sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off
sudo networksetup -setsocksfirewallproxystate $INTERFACE on
if ! [ -z $1 ]; then
mv /usr/local/etc/tor/torrc{,.t} 2>&1 > /dev/null
echo "ExitNodes {$1}" | tee /usr/local/etc/tor/torrc
fi
tor
if ! [ -z $1 ]; then
@linktohack
linktohack / PIV.F90
Last active August 29, 2015 14:17
fortran careful with implicit...
DO IPIV = 1, NPIV
WHERE (VALID(:,:,IPIV)==0)
UMOY = UMOY + U(:,:,IPIV)
VMOY = VMOY + V(:,:,IPIV)
UU = UU + U(:,:,IPIV)**2
VV = VV + V(:,:,IPIV)**2
UV = UV + U(:,:,IPIV)*V(:,:,IPIV)
NVALID = NVALID + 1
END WHERE
END DO
@linktohack
linktohack / dura.js
Last active August 29, 2015 14:17
filter link to download
console.log((function (match) {
a = document.querySelectorAll('a');
matched = [].filter.call(a, function (e) { return e.innerText.match(match); });
link = matched.map(function (e) { return window.location.href + e.getAttribute('href'); });
return link.join("\n");
})(/Horri/i));
@linktohack
linktohack / git.sh
Created March 30, 2015 08:09
git gc everything
git -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneExpire=now gc
@linktohack
linktohack / horri.js
Last active August 29, 2015 14:19
HorribleSubs all magnet links
[].filter.call(document.querySelectorAll('div.latest a'), function(e) {
return /^magnet/.test(e.getAttribute('href'));
}).filter(function(e) {
return /720p/.test(e.parentNode.parentNode.parentNode.innerText);
}).map(function (e) {
return e.getAttribute('href');
}).join('\n');
@linktohack
linktohack / .spacemacs.el
Created April 19, 2015 21:59
Emacs reset default theme
(mapc 'disable-theme custom-enabled-themes)