Skip to content

Instantly share code, notes, and snippets.

View goodjob1114's full-sized avatar

Randy Chen goodjob1114

View GitHub Profile
@goodjob1114
goodjob1114 / freeBootDiskSpace.sh
Created June 29, 2015 03:03
[ubuntu] free boot disk space
#!/bin/bash
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
@goodjob1114
goodjob1114 / genSSL.sh
Created June 24, 2015 17:52
simple ssl generate shell script
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
SSL_FOLDER="../ssl"
if [ -d "$SSL_FOLDER" ]; then
echo "ssl folder existed"
@goodjob1114
goodjob1114 / bcrypt-moment-secret.js
Last active August 29, 2015 14:22
generate some secret hash based on Moment and Bcrypt.....just for fun
var co = require('co')
var bcrypt = require('bcrypt')
var moment = require('moment')
var Promise = require('bluebird')
var bSalt = Promise.promisify(bcrypt.genSalt)
var bHash = Promise.promisify(bcrypt.hash)
var passphrase = moment().format('YYYY[RandomString]MMDDHH')
console.log('passphrase =',passphrase)
@goodjob1114
goodjob1114 / hhvm-nginx-mariadb-installMemoOnUbuntu14.04.md
Last active July 5, 2019 16:27
hhvm, nginx, php, mariadb -> [laravel] install memo used on Ubuntu 14.04

ubuntu 14.04

sysv-rc-conf (service control tool)

sudo apt-get install -y sysv-rc-conf

nginx

sudo add-apt-repository -y ppa:nginx/stable 
@goodjob1114
goodjob1114 / crypto-aes-practice.js
Created May 14, 2015 09:29
encrypt data using crypto::aes-256-cbc on Node.js
var crypto = require('crypto')
var cipher = function(key, plaintext){
console.log('cipher::init')
var cipher = crypto.createCipher('aes-256-cbc', key)
var encriptedText = cipher.update(plaintext, 'utf8', 'hex')