Skip to content

Instantly share code, notes, and snippets.

View mattatcha's full-sized avatar

Matt Aitchison mattatcha

View GitHub Profile
@mattatcha
mattatcha / mysql-s3-backup.rb
Created February 8, 2016 17:24 — forked from rahuljiresal/mysql-s3-backup.rb
Backup MySQL Database to Amazon S3 Bucket
require 'date'
require 'aws/s3'
class Settings
attr_accessor :username, :password, :database, :mysql_location, :access_key, :secret_key, :bucket_name
end
user_settings = Settings.new
user_settings.username = DATABASE_USERNAME
user_settings.password = DATABASE_PASSWORD
@mattatcha
mattatcha / db.rake
Created February 8, 2016 17:24 — forked from carpeliam/db.rake
dump, load, or clear a mysql database for a rails project
namespace :db do
desc "Clear all tables"
task :clear => :environment do
conn = ActiveRecord::Base.connection
conn.tables.select{|t| t.start_with? ActiveRecord::Base.table_name_prefix }.each do |t|
conn.drop_table t
end
end
desc "Dump database into an SQL file"
@mattatcha
mattatcha / LICENSE
Created January 30, 2016 23:46 — forked from sinisterchipmunk/LICENSE
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@mattatcha
mattatcha / README.markdown
Created October 4, 2015 04:34 — forked from terlar/README.markdown
ArchLinux on Mac Book Retina 13"
@mattatcha
mattatcha / .gitignore
Last active August 29, 2015 14:23 — forked from brianm/.gitignore
local_client
server
client
ext
@mattatcha
mattatcha / go_scp.go
Last active August 29, 2015 14:18 — forked from jedy/go_scp.go
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"code.google.com/p/go.crypto/ssh"
"crypto"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
@mattatcha
mattatcha / server.go
Last active August 29, 2015 14:14 — forked from anonymous/server.go
package deployer
import (
"fmt"
"log"
"net/http"
"github.com/mholt/binding"
)
@mattatcha
mattatcha / _readme.md
Last active August 29, 2015 14:11 — forked from brigand/_readme.md

These macros are designed to provide a literal notation for [immutable-js][1] using [sweetjs][2].

The most interesting being the Map literal

var map = im{"foo": "bar", "baz": "quux"};

This compiles to the 2d array version of Immutable.Map.

@mattatcha
mattatcha / tmux.md
Last active August 29, 2015 14:08 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
// http://stackoverflow.com/a/20735198/688275
void shuffle(int *arr, size_t n)
{
if (n > 1)
{