Skip to content

Instantly share code, notes, and snippets.

View kenjij's full-sized avatar
👨‍💻
Hacking away...

Ken J. kenjij

👨‍💻
Hacking away...
View GitHub Profile
@kenjij
kenjij / build.sh
Created November 17, 2016 18:53
Compiling Reactjs/JSX using Babel
# Usage:
# - Install npm
# - Configure package.json
# - Place source code in "src/"
# - Outputs to "app.js"
npm run build
@kenjij
kenjij / update.sh
Last active February 16, 2016 06:38
Create New Host from Ubuntu Backup Image
# Better to be root
sudo bash
# Change IP address (static)
nano /etc/network/interfaces
# Update hostnames
nano /etc/hostname
nano /etc/hosts
@kenjij
kenjij / textmate-fontsmoothing.sh
Created August 22, 2015 03:24
Font smoothing control in TextMate
# Change settings below if font renderings appear to thin or bold.
# 0: Always disabled.
# 1: Always enabled.
# 2: Disabled for dark themes.
# 3: Disabled for dark themes on high-DPI displays (default).
# Generaly, set the value to 1 if renderings appear too thin
defaults write com.macromates.TextMate.preview fontSmoothing 1
# Reset to default
@kenjij
kenjij / textmate-lineheight.sh
Created August 21, 2015 22:06
Line-height adjustment in TextMate
# This example will make Adobe Source Code Pro font look snug in TextMate.
# Adjust space above the line
defaults write com.macromates.TextMate.preview fontAscentDelta -float -2
# Adjust space below the line
defaults write com.macromates.TextMate.preview fontLeadingDelta -float 0
# Reset to default
defaults delete com.macromates.TextMate.preview fontAscentDelta
@kenjij
kenjij / gist:fd572a372096d47b3e41
Last active August 29, 2015 14:22
Installing RVM in OS X
# Install Homebrew; this will prompt you to install Xcode Command Line Developer Tools
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Agree to Xcode license; necessary for fresh install
$ sudo xcodebuild -license
# Install RVM
$ \curl -sSL https://get.rvm.io | bash -s stable
@kenjij
kenjij / geoip.sh
Last active February 14, 2024 22:32
Downloading free MaxMind GeoIP file, use with NGINX
# Download the legacy format for NGINX compatibility
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
# Unzip
gunzip Geo*.gz
# Copy to /usr/share/GeoIP/
cp Geo*.dat /usr/share/GeoIP/
@kenjij
kenjij / gist:cc93165babf1f3b4b040
Last active August 6, 2018 16:57
Secure and optimized NGINX SSL configuration
http {
# Shared cache size; 1MB = 4000 sessions
ssl_session_cache shared:SSL:10m;
# Decrease timeout if resources are low
ssl_session_timeout 10m;
# Good-bye SSL
ssl_protocols TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:!ADH:!AECDH:!MD5;
# OCSP stapling
@kenjij
kenjij / gist:4e6e3eaa602c47722ce7
Last active August 29, 2015 14:05
Self signing an SSL Certificate
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
@kenjij
kenjij / openssl.sh
Last active April 29, 2022 20:42
OpenSSL SSL certificate generation process
# Generate private key with passphrase
openssl genrsa -des3 -out server.key 2048
# Private key without passpharase; UNDERSTAND THE RISK!
openssl rsa -in server.key -out server.key-nopass
# Generate CSR to submit to CA
openssl req -new -sha256 -key server.key -out server.csr
# Check/view CSR
@kenjij
kenjij / hosts-ubuntu
Last active August 29, 2015 14:05
Hosts file on Ubuntu
127.0.0.1 localhost
127.0.1.1 myhostname
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters