Skip to content

Instantly share code, notes, and snippets.

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

Henter henter

🏠
Working from home
  • B
  • West Korean
View GitHub Profile
#!/usr/bin/env bash
# Pre-requisites
sudo apt-get -y update
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim
# Download and compile Ruby 2.0.0-p0
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
tar -xvzf ruby-2.0.0-p0.tar.gz
@henter
henter / node_install.sh
Last active December 18, 2015 10:10 — forked from clemherreman/install.sh
How to: install nodeJS on debian Squeeze, via @sekati
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev
git clone https://github.com/joyent/node.git
cd node
# 'git tag' shows all available versions: select the latest stable.
git checkout enter-a-version
# Configure seems not to find libssl by default so we give it an explicit pointer.
# Optionally: you can isolate node by adding --prefix=/opt/node
@henter
henter / apns.py
Last active December 19, 2015 05:49 — forked from fermion/apns.py
用python推送消息。 无密码验证。
import socket, ssl, json, struct
import binascii
# device token returned when the iPhone application
# registers to receive alerts
deviceToken = 'f435d683eb9d7e5680938c363ea6e38eba36a553e9b23ddd57f9a345c0da0a0e'
thePayLoad = {
'aps': {
'alert':'Oh no! Server\'s Down!',
@henter
henter / ubuntu_clean.sh
Last active December 20, 2015 01:19
cleaning work..
#安装ppa-purge
sudo apt-get install ppa-purge
#移除源
ppa-purge ppa:zanfur/php5
# clean up os first
apt-get -y purge apache2_* bind9-* xinetd samba-* nscd-* portmap sendmail-* sasl2-bin
apt-get -y purge lynx memtester unixodbc python-* odbcinst-* tff-*
apt-get autoremove && apt-get clean
@henter
henter / mongobackup.sh
Created September 19, 2013 19:37
备份mongodb
#!/bin/bash
# from http://cnodejs.org/topic/510b4923df9e9fcc58f74c44
nowtime=`date +%Y-%m-%d`
echo "============= backup start ${nowtime}============="
parentpath=/opt/mongodbbackup
@henter
henter / ubuntu_lnmp.sh
Last active December 25, 2015 10:39
install php5 mysql nginx on ubuntu
#!/bin/bash
#prepare for php5.5
sudo apt-get install -y python-software-properties
#sudo add-apt-repository ppa:ondrej/php5
sudo add-apt-repository -y ppa:zanfur/php5.5
sudo apt-get update -y
#sudo apt-get upgrade -y
@henter
henter / nginx_symfony.conf
Last active December 25, 2015 10:39
symfony2 nginx conf
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
root /path/to/sfproject/web;
# Make site accessible from http://localhost/
server_name sf.cc localhost;
error_log /var/log/nginx/sf.error.log;
@henter
henter / ubuntu_init.sh
Last active December 25, 2015 10:49
用于还是处的ubuntu
#!/bin/bash
#替换源
sudo sed -i s/us.archive.ubuntu.com/mirrors.163.com/g /etc/apt/sources.list
sudo apt-get update -y
sudo apt-get install -y vim curl git-core
@henter
henter / flush_mac_dnscache.bash
Last active January 3, 2016 13:38
flush mac dnscache
#!/bin/bash
long=`sw_vers -productVersion`
short=${long:0:4}
if [ "$short" == "10.4" ]; then
lookupd -flushcache
elif [ "$short" == "10.5" ] || [ "$short" == "10.6" ]; then
dscacheutil -flushcache
elif [ "$short" == "10.7" ] || [ "$short" == "10.8" ]; then
sudo killall -HUP mDNSResponder
elif [ "$short" == "10.9" ]; then
/*
* Simple MD5 implementation
*
* Compile with: gcc -o md5 md5.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>