Skip to content

Instantly share code, notes, and snippets.

@nk952777
nk952777 / ci-encryption-key-generator.php
Created December 6, 2015 14:15 — forked from jeffreybarke/ci-encryption-key-generator.php
This is the code I use (minus Google Analytics) for the CodeIgniter encryption key generator located at http://jeffreybarke.net/tools/codeigniter-encryption-key-generator/
<?php
/**
* Generate an encryption key for CodeIgniter.
* http://codeigniter.com/user_guide/libraries/encryption.html
*/
// http://www.itnewb.com/v/Generating-Session-IDs-and-Random-Passwords-with-PHP
function generate_token ($len = 32)
{
@nk952777
nk952777 / iptables.sh
Last active January 27, 2017 17:55
iptables settings
先匯出當前設定,避免玩壞無法還原
# iptables-save > iptables.backup
# iptables -F
# iptables -X
# iptables -Z
# iptables -A INPUT -i eth1 -p tcp --dport 80 -j ACCEPT
# /etc/init.d/iptables save
真的不小心玩壞了,就把先前匯出的設定檔匯入
@nk952777
nk952777 / auto.sh
Last active February 17, 2017 17:12 — forked from m1st0/php_build_ubuntu.sh
Compiling PHP 7 And Setup HHVM on Ubuntu 14.04/16.04 with Various Supported Modules
#! /bin/bash
wget --content-disposition ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
tar -zxvf pcre-8.40.tar.gz
apt-get -y update
apt-get -y install git
apt-get -y install openssl libssl-dev
apt-get -y install build-essential autoconf automake libtool bison re2c
@nk952777
nk952777 / lnp.sh
Last active March 14, 2017 15:36
LNH ( Linux , Nginx and PHP7 ) Setup
#! /bin/bash
wget --content-disposition ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
tar -zxvf pcre-8.40.tar.gz
apt-get -y update
apt-get -y install git
apt-get -y install openssl libssl-dev
apt-get -y install build-essential autoconf automake libtool bison re2c
@nk952777
nk952777 / nginx
Last active February 15, 2017 18:26
nginx init script
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO
@nk952777
nk952777 / php7.sh
Last active February 27, 2017 06:28
PHP 7 Setup on Ubuntu 14.04
apt-get update
apt-get install -y language-pack-en-base
locale-gen en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install -y php7.1-fpm php7.1-curl php7.1-mbstring php7.1-mcrypt php7.1-mysql libssl1.0.2 php-common php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-readline php7.1-dev php-memcached
@nk952777
nk952777 / API.md
Created March 10, 2017 01:55 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

yum -y install wget gcc libffi-devel python-devel openssl-devel
curl https://bootstrap.pypa.io/get-pip.py | sudo python
pip install cryptography
pip install scrapy
@nk952777
nk952777 / centos-7-package.sh
Created April 2, 2017 17:02 — forked from clivewalkden/centos-7-package.sh
How to add VirtualBox Guest Additions for vagrant into minimal install of Cent OS 7.
# Start the old vagrant
$ vagrant init centos-7
$ vagrant up
# You should see a message like:
# Installing Virtualbox Guest Additions 5.0.20 - guest version is unknown
$ vagrant ssh
vagrantup:~$ sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm
vagrantup:~$ sudo yum -y update
@nk952777
nk952777 / etcd.md
Created June 14, 2017 09:32 — forked from diegopacheco/etcd.md
How to Build and Install Etcd on Amazon Linux / CentOS?

Install Go and git, Download Etcd from github and build

sudo yum install -y golang git
go version
sudo git clone https://github.com/coreos/etcd
cd etcd
sudo ./build