Skip to content

Instantly share code, notes, and snippets.

View manhg's full-sized avatar

Jan manhg

  • Tokyo, Japan
View GitHub Profile
@manhg
manhg / 0_reuse_code.js
Created December 25, 2013 07:49
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@manhg
manhg / . bash_profile
Last active January 1, 2016 17:19
A ~/.bash_profile in MacOS for developer.
export JAVAPATH="/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/java/bin"
export PATH="/usr/local/sbin:/usr/local/opt/coreutils/libexec/gnubin:$JAVAPATH:/usr/bin:$PATH"
export MANPATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnuman"
export EDITOR="nano"
export SVN_EDITOR="nano"
export PS1="\u@\w$ "
set completion-ignore-case On
alias ..='cd ..'
alias ...='cd ../../../'
@manhg
manhg / ssh-copyid.sh
Created December 31, 2013 07:36
Copy my SSH public key to a remote server This is for password-less auth.
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
@manhg
manhg / gist:8551997
Created January 22, 2014 01:32
Git SVN Workflow
# Reference: http://andy.delcambre.com/2008/03/04/git-svn-workflow.html
# Init
git svn init http://svn/path
git svn fetch
# make the repository smaller, but also with many many fewer files
git repack -d
# Work on feature/bug/issue
@manhg
manhg / my.cnf
Created February 18, 2014 06:24
MySQL Config (OSX, 5.6) for reduced RAM usage (Normally ~400M, tuned into ~30M)
[mysqld]
join_buffer_size = 512K
sort_buffer_size = 64K
read_rnd_buffer_size = 256K
net_buffer_length=2K
thread_stack = 128K
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 1M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
@manhg
manhg / vhosts.conf
Created February 24, 2014 10:10
MacOSX apache development config
ServerName localhost
Listen 80
NameVirtualHost *:80
LogFormat "%h %l %u %t \"%r\" %>s %b" common
# General
<Directory "/path/projects">
php_admin_flag engine on
AllowOverride All
@manhg
manhg / iptables.conf
Created March 17, 2014 07:03
iptables.conf
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
1
00:00:00,599 --> 00:00:04,160
>> ALICE: Hi, my name is Alice Miller and this is John Brown
2
00:00:04,160 --> 00:00:06,770
>> JOHN: and we're the owners of Miller Bakery.
3
00:00:06,770 --> 00:00:10,880
@manhg
manhg / ram.sh
Last active August 29, 2015 14:01
RAM Disk, SSD tuning
#!/bin/bash
# Optimize performance by using RAM disk
# Espcially improve life for SSD
# Disable access time
mount -vuwo noatime /
# Create RAM disk
ramfs_size_mb=256
<ul class="bxslider">
<?php
$obj = (object)['written_at' => '2014.05.01', 'title' =>「目線を変えれば、学生も変わる 学生指導に自信がもてるコツ」開催決定! '];
?>
@foreach (array_fill(0, 4, $obj) as $headline)
<li>
<a href="">
<div>
<dl>
<dt>{{ $headline->written_at }} </dt>