Skip to content

Instantly share code, notes, and snippets.

View n0ts's full-sized avatar
🏠
Working from home

Naoya Nakazawa n0ts

🏠
Working from home
  • Freelancer
  • Tokyo, Japan
  • X @n0ts
View GitHub Profile
@n0ts
n0ts / ip-up
Created November 26, 2012 03:39
/etc/ppp/ip-up
#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin:$PATH
IFACE="$1"
IPADDR="$4"
GATEWAY="$5"
DEFAULT_GATEWAY="$6"
case "$IFACE" in
@n0ts
n0ts / gist:4317395
Created December 17, 2012 10:52
Google Dark Theme
/** Main css **/
@-moz-document regexp("https?://(|www\\.)google\\..*q\\=.*") {
/* text and background */
/* http://www.w3schools.com/cssref/css_colornames.asp */
html, body, table, tbody, tr, td, h1, h2,
h3, h4, h5, h6, .sfbgg, #appbar, #leftnav li, .mitem > .kl, #ms > .kl, #tbd, #atd, #leftnav, #tbdi, #hidden_modes,
#hmp, .rgsh, .gbtc, .gbmc, .gbmcc, .small #search .skunk-head, .small #search .cntrl, .small #topbar-startcol .start-edge-links,
.flex-endcol #topbar-startcol, .small #panelarrow2, .st, .ac, .s em, .ts td, .gl, #gbx4, #gbx3, #gbx4, .no, .wl, .wn, .wo, .wp, .wq,
.TO .n0, .XQRo3, .nZ, .vr, .pw, .pY .p4, .pU, .TC, .is, .z8, .T3, .s, .CDVyRd, .VP5otc-U4m8q, .VP5otc-pzeoBf, .mq, .z .m, .y .m, .z .o, .y .o, .z .h, .y .h, .hC8Wic, .TO, .xE .dW, .x .dW, .x .m, .x .o, .AL .o, .x .p, .x .h, .ii, .Bk .G2, .iq, .iI, .z .p, .y .p, .qp, #nycprv, #nycntg, .nyc_open #nycp, #wizard, #qmod, #panel1002, #opanel1002, #one *, #panel_ *, #one *.one.onmouseout, #one *.one.onmouseout, #one *.one.onmouseover #spsiz
@n0ts
n0ts / zshrc
Created January 13, 2013 03:13
zcompile
# zcompile
[ ! -f $HOME/.zshrc.zwc ] && zcompile $HOME/.zshrc
[ ! -f $HOME/.zshrc.local.zwc ] && zcompile $HOME/.zshrc.local
[ $HOME/.zshrc -nt $HOME/.zshrc.zwc ] && zcompile $HOME/.zshrc
[ $HOME/.zshrc.local -nt $HOME/.zshrc.local.zwc ] && zcompile $HOME/.zshrc.local
@n0ts
n0ts / gist:4525066
Created January 13, 2013 17:03
Updated system ruby version to 1.9.3
update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.3 500\
--slave /usr/bin/ri ri /usr/bin/ri1.9.3\
--slave /usr/bin/irb irb /usr/bin/irb1.9.3\
--slave /usr/bin/erb erb /usr/bin/erb1.9.3\
--slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.3
update-alternatives --install /usr/bin/gem gem /usr/bin/gem1.9.3 500
@n0ts
n0ts / gist:4592346
Last active December 11, 2015 11:18
lzo vs lz4 on OSX
test data log size: 87804961 bytes (about 84MB)
=== lzo ===
$ brew install lzop
$ time lzop test_compress_log
lzop test_compress_log 0.25s user 0.05s system 90% cpu 0.340 total
$ ls -lb test_compress_log.lzo
-rw-r--r-- 1 n0ts wheel 61373672 Jan 22 14:31 test_compress_log.lzo
@n0ts
n0ts / .config
Created February 4, 2013 06:16
SSH config for me
Host *
ForwardAgent yes
StrictHostKeyChecking no
LogLevel QUIET
HashKnownHosts yes
Ciphers arcfour256,aes256-cbc,arcfour128,aes192-cbc,aes128-cbc
MACs hmac-sha1-96,hmac-sha1,hmac-md5-96,hmac-md5
@n0ts
n0ts / my-apache2.patch
Last active December 15, 2015 08:59
Apache HTTPd configure.in patch
--- configure.in.orig 2013-05-17 00:55:44.763419166 +0900
+++ configure.in 2013-05-17 00:56:13.162731989 +0900
@@ -278,6 +278,9 @@
2.[[2-9]]* )
APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
;;
+ 3.[[0-9]]* )
+ APR_SETVAR(SINGLE_LISTEN_UNSERIALIZED_ACCEPT, [1])
+ ;;
* )
@n0ts
n0ts / create_tmp.sh
Created May 8, 2013 23:40
Create app/tmp directory script for CakePHP
#!/bin/sh
http_user=$1
# Set up directories
mkdir -p app/tmp/cache/models
mkdir -p app/tmp/cache/persistent
mkdir -p app/tmp/cache/views
mkdir -p app/tmp/logs
mkdir -p app/tmp/sessions
@n0ts
n0ts / pyenv_awscli.sh
Created August 23, 2013 10:02
zsh aws completion for pyenv
# pyenv
if [ -f "$HOME/.pyenv/version" ]; then
# awscli
if [ -f "$HOME/.pyenv/versions/$(cat $HOME/.pyenv/version)/bin/aws_zsh_completer.sh" ]; then
source $HOME/.pyenv/versions/$(cat $HOME/.pyenv/version)/bin/aws_zsh_completer.sh
fi
fi
@n0ts
n0ts / aws.sh
Created September 24, 2013 04:31
/etc/profile.d/aws.sh
#!/bin/sh
if [ -x "`which aws 2> /dev/null`" ]; then
AZ=`curl --connect-timeout 3 -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
if [ -n "$AZ" ]; then
export AWS_DEFAULT_REGION=`echo $AZ | cut -c 1-$((${#AZ} - 1))`
fi
complete -C aws_completer aws
fi