Skip to content

Instantly share code, notes, and snippets.

dmerrick@vagrant:~$ psql -U postgres
psql (9.1)
Type "help" for help.
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1
@dmerrick
dmerrick / lights_app.rb
Last active December 14, 2015 00:39
LightsApp
#!/usr/bin/env ruby
require 'httparty'
require 'digest/md5'
require 'json'
class LightsApp
def initialize(app_name, api_url)
@name = app_name
@dmerrick
dmerrick / runlist.md
Last active October 27, 2022 11:17
How Dana sets up a brand new Mac
# HOW TO USE TUNNELS TO ACCESS THE LAB MACHINES
# from your laptop:
# create a new tmux session:
tmux new -s tunnels
# open tunnel for HTTP:
ssh -L 4567:<IP OF LAB MACHINE>:80 <IP OF HOST ON LAB WIFI>
# create new window in tmux
# open tunnel for SSH:
ssh -L 2222:<IP OF LAB MACHINE>:22 <IP OF HOST ON LAB WIFI>
>> a = [2, 1, 3]
=> [2, 1, 3]
>> a.sort
=> [1, 2, 3]
>> a
=> [2, 1, 3]
>> a.sort!
=> [1, 2, 3]
>> a
=> [1, 2, 3]
#!/bin/bash
# take a directory of images and combine them into a movie
# create an editable list of frames for the movie
ls -1v | grep JPG > files.txt
# 1080p at 24 fps
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=21600000 -o timelapse.1080p.24fps.avi -mf type=jpeg:fps=24 mf://@files.txt -vf scale=1920:1080
# 4K at 60 fps
@dmerrick
dmerrick / raid.md
Last active December 21, 2015 06:39

Background: I have a 2TB Apple Time Capsule that I've been using to store my media. I use BitTorrent a lot, through private trackers exclusively, and I use a Netherlands-based seedbox. Recently my seedbox was upgraded from 400GB storage to 1.35TB, and I that made me download a lot more (movies and season packs of TV shows, mainly).

I filled my Time Capsule pretty fast and went looking for the next step. I decided to get a RAID array and did a few weeks of research. I didn't want to have to spend a lot of time setting up the RAID, so I looked at the sexpensive options like Drobo and ReadyNAS. I really wanted to use ZFS because that's the new hotness, but even with the easy-to-use options, it seemed like more work than I really wanted to put in.

I ended up settling on the [Synology DS1813+](http://www.synology.com/products/product.php?product_name=DS1813%2B&amp;lan

bitcoin_earnings
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"fade_fold_buttons": false,
"font_size": 12.0,
"highlight_line": true,
"ignored_packages":
[
"Vintage"
@dmerrick
dmerrick / config.ru
Created October 17, 2013 22:19
extremely simple config.ru
use Rack::Static,
:urls => ["/css", "/js", "/images"],
:root => "public"
run lambda { |env|
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'