Skip to content

Instantly share code, notes, and snippets.

View skunkworker's full-sized avatar

John Bolliger skunkworker

View GitHub Profile
@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
@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
@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
@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):
@jonyardley
jonyardley / Dockerfile
Last active March 3, 2023 21:12
Precompile Ruby on Rails assets with Docker
ARG ASSET_HOST
RUN bundle exec rake ASSET_HOST=${ASSET_HOST} RAILS_ENV=production assets:precompile
#!/usr/bin/sudo ruby
#
# revealer.rb -- Deobfuscate GHE .rb files.
#
# This is simple:
# Every obfuscated file in the GHE VM contains the following code:
#
# > require "ruby_concealer.so"
# > __ruby_concealer__ "..."
@yefim
yefim / Dockerrun.aws.json
Last active April 7, 2023 16:11
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "443"
}
@stephenscaff
stephenscaff / Random Images on Refresh
Last active October 21, 2023 07:29
Super simple way to randomly load new images on refresh via Jquery and DOM injection. Great for banners.
<!DOCTYPE html>
<head>
<!--Little CSS fade in -->
<style>
.fade-in{
-webkit-animation: fade-in 2s ease;
-moz-animation: fade-in ease-in-out 2s both;
-ms-animation: fade-in ease-in-out 2s both;
-o-animation: fade-in ease-in-out 2s both;
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@joduplessis
joduplessis / cookie-typescript-utils.ts
Created September 12, 2017 06:50
Setting, deleting and retrieving cookies in Typescript.