Skip to content

Instantly share code, notes, and snippets.


Wim Mostmans Sitebase

View GitHub Profile
branneman /
Last active Jun 19, 2021
Better local require() paths for Node.js

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

larrybolt /
Last active Jun 16, 2021
Automatically update your CloudFlare DNS record to the IP, Dynamic DNS for Cloudflare
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# Automatically update your CloudFlare DNS record to the IP, Dynamic DNS
# Can retrieve cloudflare Domain id and list zone's, because, lazy
# Place at:
# /usr/local/bin/
JorgenEvens /
Last active Dec 20, 2015
Test the build using a custom heroku buildpack on your own machine.
if [ -z $1 ]; then
echo "Usage: $0 project-location"
exit 1
if [ ! -d $1 ]; then
echo "Could not find your project"
exit 2
jonah-williams / circle.yml
Last active May 29, 2019
Automating deployments to Heroku from CircleCI
View circle.yml
- bundle exec rspec spec
branch: master
timeout: 300
Jamedjo / currency.js
Last active Dec 18, 2015
Quick currency detection script I wrote while making to test out angularjs
View currency.js
function defaultCurrencyFromLanguage(){
var lang = window.navigator.userLanguage || window.navigator.language;
var symbol = "$";
if(/gb|uk|tr|je|ta|gs|gg|im|sd|sl|vg|cy|eg|fk|gi|lb|sh|ac|ss|sd|sy/i.test(lang)) {
symbol = "£";
else if(/me|sk|ea|gf|tf|bl|mf|ie|ee|re|it|mc|si|de|es|at|yt|gp|pm|cy|pt|fr|gr|ic|be|ad|fi|lu|va|mt|sm|mq|nl|ax|cs/i.test(lang)) {
symbol = "€";
else if(/cn|jp|fm|sj/i.test(lang)) {
tomsutton1984 / node_beacon.js
Last active Dec 17, 2015
Node JS beacon to capture performance metrics from Boomerang.
View node_beacon.js
// Assumptions
// Boomerang makes beacon call to port :8080
// StatsD is running on same server (localhost)
// The following NodeJS modules are installed:
// Boomerang is configured to send custom parameters for "domain", "page_type", "user_status", "ip" and "user_agent".
DonnchaC /
Created May 5, 2013
This is a proof-of-concept script which exploited a bug in's implementation of OAuth. More information and demo at Coinbase are pretty generous and gave a 5 BTC bounty for this bug which give an attacker full control of an account, when a logged in user visits their malicious web pa…
# -*- coding: utf-8 -*-
# OAuth Authorization PoC
# Donncha O'Cearbhaill - 4/05/13
# @DonnchaC
# - PGP: 0xAEC10762
import requests
import json
from BeautifulSoup import BeautifulSoup
from flask import Flask, request, render_template
nzakas / gist:5511916
Created May 3, 2013
Using GitHub inside a company
View gist:5511916

I'm doing some research on how companies use GitHub Enterprise (or public GitHub) internally. If you can help out by answering a few questions, I'd greatly appreciate it.

  1. What is the primary setup? Is there an organization and each official repo is owned by that organization?
  2. Does every engineer have a fork of each repo they're working on?
  3. Are engineers allowed to push directly to the official repo? Or must all commits go through a pull request?
  4. Do engineers work on feature branches on the main repo or on their own forks?
  5. Do you require engineers to squash commits and rebase before merging?
  6. Overall, what is the workflow for getting a new commit into the main repository?
  7. What sort of hooks do you make use of?
  8. Are there any ops issues you encountered? (Scaling, unforeseen downtime, etc.)
View changeR53Routes.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'aws-sdk'
AWS.config( :access_key_id => ENV['AWS_ACCESS_KEY_ID'], :secret_access_key => ENV['AWS_SECRET_KEY'] )
bucket = 'route53_backups'
debug = false
hpcorona / squid.conf
Created Mar 1, 2013
simple squid3 configuration to allow all to connect to all
View squid.conf
#Recommended minimum configuration:
acl manager proto cache_object
acl localhost src
acl to_localhost dst
acl localnet src
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher