This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ grep hosts /etc/nsswitch.conf | |
hosts: files dns | |
$ grep hosty.products /etc/hosts | |
127.1.1.1 hosty.products.site.org hosty.products | |
$ strace -e open,connect getent hosts hosty.products | |
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 | |
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 | |
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set colorcolumn=81,82,83,84 | |
au! FileType gitcommit set colorcolumn=71,72,73,74 | |
let s:color_column_old = 0 | |
function! s:ToggleColorColumn() | |
if s:color_column_old == 0 | |
let s:color_column_old = &colorcolumn | |
windo let &colorcolumn = 0 | |
else | |
windo let &colorcolumn=s:color_column_old | |
let s:color_column_old = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
def encrypt(x): | |
return [((a+1)*ord(b)%256) for a,b in zip(range(len(x)), x)] | |
def decrypt(a): | |
for i in range(len(a)): | |
while not (a[i] % (i+1) == 0 and a[i]/(i+1) in range(48,123)): | |
a[i] += 256 | |
a[i] /= (i+1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[merge] | |
tool = vimdiff | |
[user] | |
name = Nima Talebi | |
email = ntd@amazon.com | |
#name = Nima Talebi | |
#email = me@nima.id.au |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validate() { | |
let -i e=0 | |
let -i balance=0 | |
let -i opset=0 | |
local ch | |
for (( i=0; i<${#1}; i++ )); do | |
ch="${1:$i:1}" | |
case "${ch}" in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
". BEGIN -={ | |
let g:solarized_termcolors=256 | |
"let colortheme="solarized" | |
". advantage candy distinguished earendel gentooish | |
". grb256 inkpot jellybeans liquidcarbon moria | |
". nu42dark twilight vividchalk wombat zenburn | |
". molokai mustang koehler blue darkblue | |
". default delek desert elflord evening |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int fn_b(int a, int b) { return a % b; } | |
int fn_c1(int a, int b, int c) { return a + b + c; } | |
int fn_c2(int a, int b, int c) { return a * b * c; } | |
int (*fn_d(int (*x)(int, int), int y))(int, int, int) { | |
return x(y, 2) ? fn_c1 : fn_c2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat <<! | |
+--------------+-----------------+-----------------+-----------------+ | |
| | var | var | var | | |
| Statement | SetNotNull | SetButNull | Unset | | |
+--------------+-----------------+-----------------+-----------------+ | |
| \${var:-word} | substitute var | substitute word | substitute word | | |
| \${var-word} | substitute var | substitute null | substitute word | | |
| \${var:=word} | substitute var | assign word | assign word | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import operator as op | |
import sys | |
from decimal import Decimal | |
import decimal | |
decimal.getcontext().prec = 6 | |
def ncr(n, r): |