Skip to content

Instantly share code, notes, and snippets.

Avatar
🐇

Christopher Blanchard cblanc

🐇
View GitHub Profile
@xphyr
xphyr / index.js
Created Jul 14, 2013
Simple Plugin for "Uptime" that send alerts via Pushover. I am not a Node hacker ... I barely understand why this code works .... but it does. I have not tried it with multiple users yet, so dont know if it will work to do multiple notifications. Let me know if you try it.
View index.js
/**
* Pushover plugin for the uptime project - https://github.com/fzaninotto/uptime
* Thanks to DMathieu for the Campfire plugin which I basically hacked up to make this
* work: https://gist.github.com/dmathieu/5592418
*
* This index.js files goes to a directory `plugins/pushover` in your installation of uptime.
*
* Notifies all events (up, down, paused, restarted) to pushover
*
* This plugin has a dependency on `pushover-notifications`.
View naturalSort.filter.js
angular
.module( "core.common.internationalization" )
.constant( "naturalSort", naturalSort )
.constant( "naturalSortComparator", naturalSortComparator );
// Comparator to be used with the orderBy filter
function naturalSortComparator( a, b ) {
return naturalSort( a.value, b.value );
}
@ryanray
ryanray / deploy.rb
Created Nov 21, 2013
I couldn't find a quick example of how to deploy a node.js app using Capistrano 3. This gist assumes you are using Capistrano 3, Upstart, Forever, ssh/forward agent, and an unprivileged user named 'deploy'. Hopefully this simple setup will help to get you started.
View deploy.rb
# config/deploy.rb
# probably a lot of ways to improve this...
set :application, 'my_app'
set :repo_url, 'git@github.com:USERNAME/my_app.git'
# should set up a deploy user
set :user, 'deploy'
set :deploy_to, '/var/www/my_app'
set :scm, :git
@jarbro
jarbro / dnsme2048dkim.md
Last active Feb 12, 2020
DNS Made Easy 2048 bit DKIM Support
View dnsme2048dkim.md

DNS Made Easy 2048 bit DKIM support

If you have ever attempted to create your own DKIM key for your own mail server you know it can be a daunting task. Every flavor SMTP DKIM configuration is a bit different. Though once you've gotten your SMTP server configured with your private and public key, the easiest part of the entire process should be to make the necessary changes at your DNS provider,right? Unfortunately, not all providers support automatically accepting 2048 bit DKIM keys and you are ready to bang your head against the wall. Why dont they support a 2048 bit key or larger? Well, their system wont automatically handle keys larger than 255 contiguous characters because they haven't updated their interfaces to handle RFC 4408. More on this in a bit.

If you are using DNS Made Easy like I was, you probably ran across the error when trying to enter your DKIM key.

"Contiguous strings may not be longer than 255 characters"

Thankfully, [DNS RFC 4408](https

@ianmurrays
ianmurrays / deploy.rb
Created Jul 21, 2011
Runs test locally before deploying on capistrano.
View deploy.rb
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"
View automongobackup.sh
#!/bin/bash
#
# MongoDB Backup Script
# VER. 0.1
# Note, this is a lobotomized port of AutoMySQLBackup
# (http://sourceforge.net/projects/automysqlbackup/) for use with
# MongoDB.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
View latency.markdown

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns  = 250 µs           4X memory
@ducin
ducin / console-load-js-script.js
Last active Feb 18, 2021
load js script from blank page browser (execute following code in the browser console)
View console-load-js-script.js
(function(root){
root.getScript = function(url) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
document.head.appendChild(script);
}
}(window));
getScript('http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.js');
@philipashlock
philipashlock / index.html
Last active Mar 15, 2021
ISO 8601 Date Validation
View index.html
<html lang="en">
<head>
</head>
<body>
<pre>
<script type="text/javascript">
@Burnsy
Burnsy / .meshrc.yaml
Last active Apr 6, 2021
GraphQL Mesh Implementation of ideal-postcodes.co.uk
View .meshrc.yaml
sources:
- name: idealPostcodes
handler:
openapi:
source: https://openapi.ideal-postcodes.dev/openapi.yaml
baseUrl: https://api.ideal-postcodes.co.uk/v1/
operationHeaders:
Authorization: IDEALPOSTCODES api_key="XXXXXXX"
serve:
port: 8912