Skip to content

Instantly share code, notes, and snippets.

@danalloway
danalloway / dst.js
Last active March 1, 2020 17:29
Calculate DST in Javascript
/**
* Daylight Savings Time
*
* Since 2007 DST begins on the second sunday of March,
* and ends on the first sunday of November.
*
* @see http://www.nist.gov/pml/div688/dst.cfm
* @author Dan Alloway <dan@micahsix.com>
*/
@danalloway
danalloway / ssl.nginxconf
Last active May 15, 2017 12:37
Force full, secure SSL configuration on an NGINX site.
# capture HTTP requests to example.com and www.example.com
# and permanently redirect them to the HTTPS version of the site
#
server {
listen 80; # IPv4
listen [::]:80; # IPv6
server_name example.com www.example.com;
@danalloway
danalloway / bitcoin.conf
Last active February 10, 2018 22:05
My Bitcoin & P2Pool Configuration files.
server=1
daemon=1
rpcuser=
rpcpassword=
blockmaxsize=1000000
mintxfee=0.00001
minrelaytxfee=0.00001
Verifying myself: My Bitcoin username is +daniam. https://onename.io/daniam
@danalloway
danalloway / legacy.php
Created July 11, 2014 17:40
Drupal - Feeds Tamper - Legacy Import ID Swap
<?php
/**
* When migrating Drupal sites using Feeds sometimes you'll need to re-map entity relationships.
* When importing User Accounts, I always save the legacy UID from the old system.
* Then while importing data that needs to re-map to the UID, I load it the legacy UID from the CSV,
* then swap it out with the newley created ID using Feeds Tamper PHP.
*/
if (!empty($field)) {
@danalloway
danalloway / devcoin.sh
Last active May 15, 2017 12:38
compile devcoin on ubuntu 14.04
sudo aptitude update && sudo aptitude safe-upgrade
sudo aptitude install build-essential python-software-properties autoconf libtool libssl-dev libboost-all-dev libdb4.8-dev libdb4.8++-dev
sudo aptitude add-apt-repository ppa:bitcoin/bitcoin
sudo aptitude install bitcoin
sudo aptitude build-dep bitcoin
cd ~
git clone https://github.com/coinzen/devcoin.git
@danalloway
danalloway / gist:75987741194344df03c3
Created June 7, 2014 02:57
FFMPEG - Convert / Copy MKV to MP4 container format
# straight copy mkv to mp4
# no conversion takes place
# 100% passthru for both audio and video
ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4
@danalloway
danalloway / index.html
Last active October 27, 2015 19:56
HTML5 Boilerplate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>