Skip to content

Instantly share code, notes, and snippets.

View andrhamm's full-sized avatar
:shipit:
Shipping 🔥 & ⚡️

Andrew Hammond andrhamm

:shipit:
Shipping 🔥 & ⚡️
View GitHub Profile
@ldez
ldez / gmail-github-filters.md
Last active March 11, 2024 00:08
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
@danieleggert
danieleggert / GPG and git on macOS.md
Last active March 26, 2024 14:22
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@wngreene
wngreene / bag_to_images.py
Last active March 23, 2024 17:54
Extract images from a rosbag.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2016 Massachusetts Institute of Technology
"""Extract images from a rosbag.
"""
import os
import argparse
@LauLaman
LauLaman / gpg.md
Last active March 7, 2023 14:42
Use GPG to sign commits using git & PHPStorm

1 - install GPG tools : https://gpgtools.org/

2 - Create new key for your github email

3 - Add key to git on your local machine: git config --global user.signingkey YOURKEY

4 - configure git to sign all commits: git config --global commit.gpgsign true

5 - add to the bottom of ~/.gnupg/gpg.conf: (create the file if it not exists)

@dhoelzgen
dhoelzgen / base_controller.rb
Last active October 7, 2021 16:19
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
@Integralist
Integralist / GitHub curl.sh
Last active September 7, 2023 03:53 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@sauloperez
sauloperez / signal_catching.rb
Last active November 11, 2020 11:25
How to catch SIGINT and SIGTERM signals in Ruby
# Signal catching
def shut_down
puts "\nShutting down gracefully..."
sleep 1
end
puts "I have PID #{Process.pid}"
# Trap ^C
Signal.trap("INT") {
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@nhoffmann
nhoffmann / deploy.rb
Created April 3, 2012 14:07
Capistrano recipe for deploying static content.
set :application, "My Static Content"
set :servername, 'test.example.com'
# no git? simply deploy a directory
set :scm, :none
set :repository, "." # the directory to deploy
# using git? deploy from local git repository
# set :scm, :git
# set :repository, 'file//.' # path to local git repository
@relistan
relistan / compress_requests.rb
Last active April 18, 2023 23:54 — forked from subdigital/compress_requests.rb
Rack Middleware to automatically unzip gzipped/deflated POST data
class CompressedRequests
def initialize(app)
@app = app
end
def method_handled?(env)
!!(env['REQUEST_METHOD'] =~ /(POST|PUT)/)
end
def encoding_handled?(env)