Skip to content

Instantly share code, notes, and snippets.


John Bolliger skunkworker

View GitHub Profile
mmmries / CssHelper.js
Created Mar 16, 2016
Client Specific Colorschemes in Javascript
View CssHelper.js
var ColorConversion = require('helpers/ColorConversion');
Used for parsing all css rules on the document
object and replacing any default brand color
instances with the client's brand color scheme.
@class CssHelper
tovbinm / crontab
Created Feb 22, 2012
Logrotate & upload nginx logfiles to s3://bucket/dt=..../hostname.log...gz
View crontab
# Nginx - logrotate & upload to S3
0 0 * * * /usr/sbin/logrotate /etc/logrotate.d/nginx
15 0 * * * s3cmd put /var/log/nginx/access.log-`date +"\%Y\%m\%d"`.gz s3://$LOGS_BUCKET_NAME/nginx-access/`date +"dt=\%Y\%m\%d"`/`hostname -s`.access.log-`date +"\%Y\%m\%d"`.gz
tzvetkoff /
Last active Jan 2, 2018
Sublime Text plugin that tries to detect and mark zero-width characters
import sublime
import sublime_plugin
class ShowZeroWidthCharacters(sublime_plugin.EventListener):
Tries to detect and mark zero-width joiners, non-joiners, and other invisible characters.
Most of the characters were detected by manually testing code points from C++ specs.
dteoh /
Last active Apr 28, 2018
Adding extra test paths to Rails 5 `rails test` command

In Rails 4.x, you could add extra test paths to rake test by overriding the Rake task like so:


namespace :test do do |t|
    paths = ['test/**/*_test.rb']
    paths << 'engines/foo_engine/test/**/*_test.rb'
elberskirch /
Last active Jan 16, 2019
Capistrano deployment for jekyll


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
pablopaul / deploy.rb
Last active Feb 5, 2019 — forked from cannikin/deploy.rb
Notify Sentry of a new release via Capistrano with Auth Token
View deploy.rb
# 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_ORG'] : the organization for this app
# ENV['SENTRY_PROJECT'] : the project for this app
youngbrioche / images_helper.rb
Last active Sep 13, 2019
Responsive images helper using srcset in Rails
View images_helper.rb
module ImagesHelper
# Acts as a thin wrapper for image_tag and generates an srcset attribute for regular image tags
# for usage with responsive images polyfills like picturefill.js, supports asset pipeline path helpers.
# image_set_tag 'pic_1980.jpg', { 'pic_640.jpg' => '640w', 'pic_1024.jpg' => '1024w', 'pic_1980.jpg' => '1980w' }, sizes: '100vw', class: 'my-image'
# => <img src="/assets/ants_1980.jpg" srcset="/assets/pic_640.jpg 640w, /assets/pic_1024.jpg 1024w, /assets/pic_1980.jpg 1980w" sizes="100vw" class="my-image">
def image_set_tag(source, srcset = {}, options = {})
srcset = { |src, size| "#{path_to_image(src)} #{size}" }.join(', ')
View rails-routes-visualizer.txt
$ rails r 'File.write("./viz.html", Rails.application.routes.router.visualizer)'
$ ruby -r webrick -e "s = => 8080, :DocumentRoot => Dir.pwd); trap('INT') { s.shutdown }; s.start"
$ open "http://localhost:8080/viz.html"


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
usmansaleem /
Last active Apr 9, 2020
Raspberry pi as PP2P vpn gateway


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.


  • 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 ( is PI ip address, is the WAN router IP address):