Skip to content

Instantly share code, notes, and snippets.

View emj365's full-sized avatar
🎯
Focusing

Michael JIN emj365

🎯
Focusing
View GitHub Profile
@emj365
emj365 / authorized_keys
Last active March 5, 2017 10:42
docker registry
no-pty,no-X11-forwarding,permitopen="127.0.0.1:5000",permitopen="127.0.0.1:8080",command="/bin/echo do-not-send-commands" ssh-rsa <key-string> <id>
@datchley
datchley / react-redux-style-guide.md
Last active February 13, 2024 14:30
React + Redux Style Guide
@kiewic
kiewic / xhubsignature.js
Created November 17, 2016 08:39
How to validate a X-Hub-Signature header when using Express.js and body-parser
var express = require('express');
var bodyParser = require('body-parser')
var crypto = require('crypto');
// Calculate the X-Hub-Signature header value.
function getSignature(buf) {
var hmac = crypto.createHmac("sha1", process.env.FB_APP_SECRET);
hmac.update(buf, "utf-8");
return "sha1=" + hmac.digest("hex");
}
@nrollr
nrollr / nginx.conf
Last active April 22, 2024 15:11
NGINX config for SSL with Let's Encrypt certs
# UPDATED 17 February 2019
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
listen [::]:80;
server_name www.domain.com domain.com;
return 301 https://$host$request_uri;
}
# SSL configuration
@bmhatfield
bmhatfield / .profile
Last active March 18, 2024 07:43
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@aliuygur
aliuygur / add-swap-file.sh
Created May 28, 2015 13:59
this file add 4GB swap file to ubuntu 14.04 x64
#!/bin/bash
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
echo "Added!"
free -m
@wdullaer
wdullaer / install.sh
Last active April 2, 2024 20:33
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"
@mircobabini
mircobabini / Angular.Ionic.HardwareBackButtonManager.js
Last active November 8, 2018 08:44
HardwareBackButtonManager Service for Ionic (Angular.js) provides an interface to easily enable or disable the hardware back button on Android
.service( 'HardwareBackButtonManager', function($ionicPlatform){
this.deregister = undefined;
this.disable = function(){
this.deregister = $ionicPlatform.registerBackButtonAction(function(e){
e.preventDefault();
return false;
}, 101);
}
@edgarsilva
edgarsilva / StandardFirmataForATH0.ino
Created July 16, 2014 18:25
Modified firmata protocol that works on the arduino YUN linux side communicating to the arduino side using the ttyATH0 serialport interface.
/*
* Firmata is a generic protocol for communicating with microcontrollers
* from software on a host computer. It is intended to work with
* any host computer software package.
*
* To download a host software package, please clink on the following link
* to open the download page in your default browser.
*
* http://firmata.org/wiki/Download
*/