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
#!/bin/bash
for filename in $(
find . -name "*.php"
)
do
r=`sed -n '$p' "$filename"`
if [[ $r == "?>" ]]
then
#sed -e '$d' "$filename" #for linux
sed -i '' '$d' "$filename" #for mac
@henter
henter / check_php_ending
Created June 5, 2014 12:59
check php file ending
#!/bin/bash
for filename in $(
find . -name "*.php"
)
do
r=`sed -n '$p' "$filename"`
if [[ $r == "?>" ]]
then
echo "$filename"
fi
location /stats/ {
alias /Users/henter/Work/stats/;
location ~ .php {
set $path_info "";
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)") {
set $path_info $2;
}
fastcgi_pass 127.0.0.1:9000;
@henter
henter / 0_reuse_code.js
Created April 22, 2014 04:03
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
@henter
henter / centos_init.sh
Last active September 10, 2015 09:23
#!/bin/bash
#for php56
sudo rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
sudo yum update -y
@henter
henter / apns.py
Last active August 29, 2015 13:55
https://github.com/henter/PythonRabbitMQAPN Python结合RabbitMQ实现多线程APN推送
import socket, ssl, json, struct
import binascii
def Payload(alert='', badge=1, data={}):
payload = {
'aps': {
'alert':alert,
'sound':'k1DiveAlarm.caf',
'badge':badge,
},
@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
@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 / 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;