Skip to content

Instantly share code, notes, and snippets.

View solarsailer's full-sized avatar

Matthieu Oger solarsailer

View GitHub Profile
@solarsailer
solarsailer / fish.md
Last active August 29, 2015 13:57
Set fish as default shell.

Install

brew install fish

Symlink the config folder:

ln -sf ~/PATH/TO/DROPBOX/FISH/CONFIG ~/.config/

Change

# To create a pre-commit hook:
# cd .git/ && mkdir hooks && cd hooks && touch pre-commit && chmod +x pre-commit
# -------------------------------------------------------
# PUPPET-LINT
# -------------------------------------------------------
#!/bin/bash
# Requires bash, as it uses the [[ ]] syntax.
#

Application

Create an app with Automator that shows a notification and play a sound (available here).

Put it in your /Applications folder.

Scheduling

Type this in a shell:

@solarsailer
solarsailer / convert_images.rb
Last active August 29, 2015 14:11
Convert a list of images (dup and crop a base image and create a thumbnail).
#!/usr/bin/env ruby
# Example (crop at 100x100):
# convert_images.rb -x 100 -y 100
require 'optparse'
# This script needs imagemagick.
if !system("which convert > /dev/null 2>&1")
puts "Abort! Require ImageMagick."
@solarsailer
solarsailer / convert_font.sh
Last active August 29, 2015 14:13
Convert a font to a bitmap sprite.
#!/usr/bin/env bash
# Example:
# $ convert -background none -fill white -font font.ttf -pointsize 8 label:"CHARSET" bitmap.png
CHARSET='!"#$&'\''()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'
convert -background none -fill white -font 04B03.ttf -pointsize 8 label:"$CHARSET" bitmap.png
@solarsailer
solarsailer / bml_pattern_quick_shot.xml
Created January 23, 2015 17:06
BulletML Quick Shot Pattern
<?xml version="1.0"?>
<!DOCTYPE bulletml SYSTEM "bulletml.dtd">
<bulletml type="horizontal" xmlns="http://www.asahi-net.or.jp/~cs8k-cyu/bulletml">
<action label="top">
<repeat>
<!-- Main Loop -->
<times>99999</times>
@solarsailer
solarsailer / convert_cm_to_px.sh
Last active August 29, 2015 14:15
Convert CM to Pixels.
# CM to PX.
DPI * (XXX cm / 2.54 cm) = size in pixels.
@solarsailer
solarsailer / scale.sh
Created June 30, 2015 09:25
Put in an Automator service with "Run Shell Script" (set with "Pass Input as Arguments").
for f in "$@"
do
mime=`file --mime-type $f`
if [[ $mime == *"image/"* ]]
then
/usr/local/bin/mogrify -scale 400% -strip $f
fi
done
private HttpClient client;
public HttpModule() {
client = new DefaultHttpClient();
}
public void executePost() {
HttpPost post = new HttpPost(APIConfiguration.getURL(Protocol.HTTPS, "user"));
Console.log(post.getURI());
@solarsailer
solarsailer / gist:953528
Created May 3, 2011 15:24
Recursively remove all .svn directories
find . -name .svn -print0 | xargs -0 rm -rf