Skip to content

Instantly share code, notes, and snippets.

@aarongustafson
aarongustafson / backup-to-git.sh
Created August 10, 2011 15:44
DB Backup to Git
#!/bin/bash
##
# MySQL DB dump to Git commit
#
# Dumps the specified mysql database to the given location and commits it and
# the previous database to the Git repository.
#
# It is assumed you have already setup the Git respository to only be the
# a checkout of the database backup location
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@moraes
moraes / gist:2141121
Last active May 1, 2023 19:02
LIFO Stack and FIFO Queue in golang
package main
import (
"fmt"
)
type Node struct {
Value int
}
@emiller
emiller / git-mv-with-history
Last active April 17, 2024 21:06
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@xf1
xf1 / remux
Created April 29, 2014 04:41
Remuxing with eac3to
Remuxing
Why Remux Blu-rays?
-You use MPC-HC (or similar DShow players) and standard filters for playback. You can also use better quality renderers like Haali, EVR and madVR.
-You get the ease of playback of a re-encode without the quality loss. A double click off the .mkv will start the movie - no annoying warnings, loading screens, previews and setup menus.
-You don't have to deal with horribly bloated, unstable and expensive PowerDVD or Arcsoft playback software.
-You don't have to mess with ISO creation, correct BD folder structure, UDF and SPTD drivers, and image mounting every time you want to watch a movie.
-You never have to worry about the region code setting of a disc.
-You never have to worry about HDCP or PAP content protection.
-You never have to worry about your software player downsampling your audio - get full bit-depth and frequency resolution, 24bit/96kHz or higher, not 16/48.
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@cheeaun
cheeaun / rdrc2015.md
Last active September 15, 2016 08:49
RedDotRubyConf 2015 links & resources 😘
<!DOCTYPE html>
<html lang="en">
<head>
<title>WordCamp Lancaster Badge Demo</title>
<style>
html,
body {
float: none;
}
.attendee {
@gaqzi
gaqzi / gfm-formatter.py
Last active June 3, 2022 04:20
A way to re-use the GitHub syntax highlighter for your own site. Send it through their API, use their stylesheet and done.
#!/usr/bin/env python
# Takes the path to a local file and formats it using GitHub's raw Markdown API,
# then converts the returned HTML to their table format.
from pathlib import Path
from sys import argv
import requests # $ pip install requests