Skip to content

Instantly share code, notes, and snippets.

View caesar's full-sized avatar
Probably at sea

Caesar Schinas caesar

Probably at sea
View GitHub Profile
@reasonableperson
reasonableperson / sqlite3-git-smudge-filter.md
Last active March 26, 2021 01:20
sqlite3-git-smudge-filter

If you configure git like this:

git config filter.sqlite3.clean 'sqlite3 %f .dump'
git config filter.sqlite3.smudge 'sqlite3 %f'
echo '*.db filter=sqlite3' >> .git/info/attributes

and you have an sqlite3 database in a *.db file:

@mterwill
mterwill / USAGE.md
Last active February 16, 2024 09:23
Beancount importers, scripts, etc.

Note: everything here is pretty specific to my usage/accounts and not written for public use... You'll probably have to tweak a bunch of stuff.

$ bean-extract config.py ~/Downloads # the csvs should be in here
@pkulak
pkulak / camera_dl.rb
Last active March 9, 2017 16:04
A simple script to get the files off your Olympus camera.
#!/usr/bin/env ruby
require 'open-uri'
require 'time'
require 'json'
class Runner
def initialize
@base = "http://192.168.0.10/DCIM/100OLYMP"
@caesar
caesar / post-receive
Last active April 21, 2020 21:40
Git website deployment post-update script for live and staging with multiple branches. Based on code from http://www.ekynoxe.com/git-post-receive-for-multiple-remote-branches-and-work-trees/
#!/bin/bash
live_dir="/path/to/live/site"
dev_dir="/path/to/dev/site"
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
if [ "master" == "$branch" ]; then
@caesar
caesar / Thunderbird Launcher.applescript
Last active February 8, 2020 09:44
Automate loading of Thunderbird profile on encrypted disk image (OS X)
-- Thunderbird Launcher app
-- Mounts a disk image before launching Thunderbird, and unmounts it when Thuderbird closes
-- by Caesar Schinas, based on ideas at http://hintsforums.macworld.com/showthread.php?t=26597
on run
set diskname to "Thunderbird Profile"
set diskpath to "~/Library/Thunderbird/Profiles/Thunderbird Profile.sparsebundle"
set itemname to "/Applications/Thunderbird"
tell application "Finder"
if not (exists the disk diskname) then
@toolmantim
toolmantim / Makefile
Last active December 5, 2022 23:14
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
@benklocek
benklocek / post-update
Last active December 16, 2015 22:09
Git Hub repo post-update hook to update based on branch pushed. modified from http://blog.ekynoxe.com/2011/10/22/git-post-receive-for-multiple-remote-branches-and-work-trees/
#!/bin/bash
#
# post-update hook for Hub git repo
# http://stackoverflow.com/questions/5753346/git-automatically-push-to-dev-and-production-from-central-repository-depending-o?rq=1
# post-update only receives refname
# TODO: adjust for post-update ref, and cd to Prime and pull
#
livepath="/path/to/your/live"
devpath="/path/to/your/dev"
while read oldrev newrev ref
@henrik
henrik / unsimple_format.rb
Created November 28, 2008 09:04
Like Rails' simple_format but avoids <p>/<br /> around some block tags.
# From Rails
def simple_format(text, html_options={})
start_tag = '<p>'
text = text.to_s.dup
text.gsub!(/\r\n?/, "\n") # \r\n and \r -> \n
text.gsub!(/\n\n+/, "</p>\n\n#{start_tag}") # 2+ newline -> paragraph
text.gsub!(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
text.insert 0, start_tag
text << "</p>"
end