Skip to content

Instantly share code, notes, and snippets.

Avatar
🐇

Christopher Blanchard cblanc

🐇
View GitHub Profile
@f3l1x
f3l1x / aliases
Last active Apr 7, 2021
Docker - installation, tips, commands, aliases
View aliases
# ------------------------------------
# Docker alias and function
# ------------------------------------
# Get latest container ID
alias dl="docker ps -l -q"
# Get container process
alias dps="docker ps"
@rtgibbons
rtgibbons / logger.js
Created Nov 7, 2013
Logger Library with winston
View logger.js
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@karmi
karmi / nginx-elasticsearch-proxy.conf
Created May 23, 2011
Route requests to ElasticSearch to authenticated user's own index with an Nginx reverse-proxy
View nginx-elasticsearch-proxy.conf
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost:8080/_search?q=*
#
# is rewritten to:
#
@heyMP
heyMP / utils.js
Last active Aug 3, 2021
Recursively find elements through multiple layers of shadow dom.
View utils.js
/**
* Example usage:
* const hotspots = findAllDeep(this.shadowRoot.querySelector('slot'), `[slot*="hotspot"]`, 1);
*/
export const findAllDeep = (parent, selectors, depth = null) => {
let nodes = [];
let currentDepth = 1;
const recursiveSeek = _parent => {
// record the nodes
for (let child of _parent.assignedNodes({ flatten: true })) {
@iloveitaly
iloveitaly / capybara_fill_stripe_elements.rb
Created Mar 4, 2017
Fill in a Stripe Elements (https://stripe.com/docs/elements) credit card field using capybara
View capybara_fill_stripe_elements.rb
def fill_stripe_elements(card)
using_wait_time(15) { within_frame('stripeField_card_element0') do
card.to_s.chars.each do |piece|
find_field('cardnumber').send_keys(piece)
end
find_field('exp-date').send_keys("0122")
find_field('cvc').send_keys '123'
find_field('postal').send_keys '19335'
end }
@henrik
henrik / hash_deep_diff.rb
Created Jul 14, 2009
Recursively diff two Ruby hashes.
View hash_deep_diff.rb
# Recursively diff two hashes, showing only the differing values.
# By Henrik Nyh <http://henrik.nyh.se> 2009-07-14 under the MIT license.
#
# Example:
#
# a = {
# "same" => "same",
# "diff" => "a",
# "only a" => "a",
# "nest" => {
@duncansmart
duncansmart / progressive-ace.htm
Created Mar 28, 2013
Integrating ACE Editor in a progressive way
View progressive-ace.htm
<textarea name="my-xml-editor" data-editor="xml" rows="15"></textarea>
...
<textarea name="my-markdown-editor" data-editor="markdown" rows="15"></textarea>
...
<script src="//d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script>
<script>
// Hook up ACE editor to all textareas with data-editor attribute
$(function () {
@andrius
andrius / Procfile
Last active Sep 24, 2021
How to dockerize #rails app with #puma. Edit config/application.rb and config/puma.rb #docker #ruby
View Procfile
api: bundle exec puma -C config/puma.rb
@atika
atika / pushover
Last active Oct 19, 2021
Send a pushover notification from Bash
View pushover
#!/bin/bash
# ./pushover.sh -t "Pushover via Bash" -m "Pushover message sent with bash from $(hostname -f)" -p1 -s siren -u http://www.google.com -n "Google"
USER_TOKEN=YOUR_USER_TOKEN_HERE
# YOUR APPS TOKENS / UPPERCASE NAME WITH _TOKEN (usage: "-a monitor" uses MONITOR_TOKEN)
MONITOR_TOKEN=APP_TOKEN
BACKUP_TOKEN=APP_TOKEN
ALERT_TOKEN=APP_TOKEN
APP_LIST="monitor, backup, alert" # FOR USAGE
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active Oct 22, 2021
Steps to install a Comodo PositiveSSL certificate with Nginx.
View install-comodo-ssl-cert-for-nginx.rst

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert