Skip to content

Instantly share code, notes, and snippets.

View skunkworker's full-sized avatar

John Bolliger skunkworker

View GitHub Profile
@usmansaleem
usmansaleem / rpi2vpngateway.md
Last active March 3, 2023 11:23
Raspberry pi as PP2P vpn gateway

Goal

In Progress

Use Raspberry PI 2 as a PP2P VPN gateway so that devices on the network can be configure to use PI as gateway which should direct the internet traffic through VPN.

Setup

  • Modify main router to issue DHCP address so that PI can be assigned an IP address outside the range.
  • Connect PI using ethernet cable. WIFI may also be used, however, following instructions assume eth.
  • Setup PI with static IP address. Modify /etc/dhcpcd.conf with following contents (192.168.1.2 is PI ip address, 192.168.1.1 is the WAN router IP address):
@mattheworiordan
mattheworiordan / application.rb
Created March 28, 2014 09:05
CloudFlare IP Middleware for Rails to ensure HTTP_CF_CONNECTING_IP is used and the clients IP is correct within Rails
module RailsAppName
class Application < Rails::Application
# .... your settings
require "#{Rails.root}/lib/cloud_flare_middleware"
config.middleware.insert_before(0, Rack::CloudFlareMiddleware)
# ... your settings
end
end
@joker1007
joker1007 / Dockerfile
Last active July 4, 2022 13:55
Sample Dockerfile for rails app
FROM appbase
# install npm & bower packages
WORKDIR /root
COPY package.json bower.json /root/
RUN npm install --only=prod && \
npm cache clean && \
bower install --allow-root
# install gems
@mbrochh
mbrochh / gist:964057
Last active November 10, 2021 19:08
Fast Forward Your Fork
# kudos to https://github.com/drewlesueur
# stolen from here: https://github.com/blog/266-fast-forward-your-fork#comment-11535
git checkout -b upstream-master
git remote add upstream git://github.com/documentcloud/underscore.git
git pull upstream master
git checkout master // [my master branch]
git merge upstream-master
git push origin master
@stuartsierra
stuartsierra / fresh-chrome.sh
Last active October 13, 2020 16:07
Launch new instances of Google Chrome on OS X with isolated cache, cookies, and user config
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
@ianmurrays
ianmurrays / deploy.rb
Created July 21, 2011 17:26
Runs test locally before deploying on capistrano.
set :test_log, "logs/capistrano.test.log"
namespace :deploy do
before 'deploy:update_code' do
puts "--> Running tests, please wait ..."
unless system "bundle exec rake > #{test_log} 2>&1" #' > /dev/null'
puts "--> Tests failed. Run `cat #{test_log}` to see what went wrong."
exit
else
puts "--> Tests passed"

Prerequisites:

You'll need:

  1. A paid ngrok account
  2. A reserved domain on ngrok, e.g. the FQDN you're generating certs for
  3. A registed domain and access to change DNS records

How to

  1. Install certbot and ngrok
  • brew cask install certbot ngrok
$ rails r 'File.write("./viz.html", Rails.application.routes.router.visualizer)'
$ ruby -r webrick -e "s = WEBrick::HTTPServer.new(:Port => 8080, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start"
$ open "http://localhost:8080/viz.html"
@pablopaul
pablopaul / deploy.rb
Last active February 5, 2019 19:19 — forked from cannikin/deploy.rb
Notify Sentry of a new release via Capistrano with Auth Token
# This task will notify Sentry via their API[1] that you have deployed
# a new release. It uses the release timestamp as the `version`
# (like 20151113182847) and the git ref as the optional `ref` value.
#
# This task requires several environment variables be set (or just
# hardcode the values in here if you like living on the edge):
#
# ENV['SENTRY_API_ENDPOINT'] : API endpoint, https://app.getsentry.com
# ENV['SENTRY_ORG'] : the organization for this app
# ENV['SENTRY_PROJECT'] : the project for this app
@elberskirch
elberskirch / jekyll-deployment.md
Last active January 16, 2019 03:06
Capistrano deployment for jekyll

introduction

This is a short rundown for setting up deployment for a jekyll blog using a self-hosted git repository and a vserver running nginx. Deployment is done with capistrano (version 3).

Github is probably the most common and most convenient way to host your code for your jekyll blog, but sometimes you might want to keep everything under your own control or you're just curious what barebones git does for you.

setting up the git repository

For setting up a git repository on a linux machine I used this guide. A short wrapup:

  • add a git user