Skip to content

Instantly share code, notes, and snippets.

John Agan johnagan

Block or report user

Report or block johnagan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@johnagan
johnagan / auth.test.json
Last active Apr 29, 2017
OAuth Medium post snippets
View auth.test.json
{
"ok": true,
"url": "https:\/\/myteam.slack.com\/",
"team": "My Team",
"user": "cal",
"team_id": "T12345",
"user_id": "U12345"
}
View server.rb
require 'net/http'
require 'sinatra'
require 'json'
require 'uri'
CONTEXT = "spoof check"
GITHUB_ROOT = "https://api.github.com"
HEADERS = {
'Content-Type' => 'text/json',
'Authorization' => "token #{ENV['GITHUB_TOKEN']}"
View html2slim.rb
require 'html2slim'
html_path = ""
slim_path = ""
Dir.mkdir(slim_path) unless File.exists?(slim_path)
Dir["#{html_path}/*.html"].each do |file_name|
html = File.read(file_name).encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
File.open("#{slim_path}/#{File.basename(file_name)}.slim", 'w') do |f|
View github.css
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px;
color: #333;
}
View ssh_tunnel
#!/bin/bash
disable_proxy()
{
networksetup -setsocksfirewallproxystate Wi-Fi off
networksetup -setsocksfirewallproxystate Ethernet off
echo "SOCKS proxy disabled."
}
trap disable_proxy INT
networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 9999
View .gitignore_global
# Usage
# git config --global core.excludesfile ~/.global_ignore
# General ------------------------------
*.psd
# OSX ----------------------------------
.DS_Store
@johnagan
johnagan / githook.sh
Created May 22, 2011
A sample git hook to update webroot on commit
View githook.sh
# Bring in Source Control
mkdir ~/repo
cd ~/repo
git init --bare
# Create a git hook
cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/home/ubuntu/www
You can’t perform that action at this time.