Skip to content

Instantly share code, notes, and snippets.

View CapnKernel's full-sized avatar

Mitch Davis CapnKernel

  • Melbourne, Australia
View GitHub Profile
find . -iname \*.JPG -o -iname \*.JPEG -print | while read; do
# read puts the line it just read into REPLY
OUTPUT="${REPLY/.JPG/-resize.JPG}"
convert -resize 60% -quality 80 "$REPLY" "$OUTPUT"
done
find . \( -iname \*.JPG -o -iname \*.JPEG \) -print | while read; do
# read puts the line it just read into REPLY
OUTPUT="$(echo $REPLY | sed -r -e 's@(.*)\.(jpg|jpeg|JPG|JPEG)$@\1-resize.\2@g')"
echo convert -resize 60% -quality 80 "$REPLY" "$OUTPUT"
done
CONVERT=echo convert
CONVERT_FLAGS=-resize 60% -quality 80
# Get a list of all .jpg and .JPG files, except for ones with '-resize' in the name
IN_FILES:=$(shell find -iname '*.jpg' | grep -v -- "-resize")
$(info IN_FILES=$(IN_FILES))
# From that list, generate a list of output filenames.
# We do this in two lines, one for .jpg, and one for .JPG
OUT_FILES_tmp:=$(patsubst %.jpg,%-resize.jpg,$(IN_FILES))
# Rule 1:
foo.o: foo.c
gcc -o foo.o -c foo.c
# Rule 1a (same):
foo.o: foo.c
gcc -o $@ -c $<
# Rule 1b (same, for foo.o):
%.o: %.c
@CapnKernel
CapnKernel / gist:4167643
Created November 29, 2012 08:46
fix for a copy-and-paste error in gerbmerge-1.8 which created small alignment issues
diff -u -r gerbmerge-1.8-pristine/gerbmerge/gerbmerge.py gerbmerge-1.8/gerbmerge/gerbmerge.py
--- gerbmerge-1.8-pristine/gerbmerge/gerbmerge.py 2011-06-09 06:07:55.000000000 +0800
+++ gerbmerge-1.8/gerbmerge/gerbmerge.py 2012-11-26 16:20:05.526473454 +0800
@@ -158,7 +158,7 @@
else:
x = MaxXExtent + x
if y>=0:
- y += OriginX
+ y += OriginY
else:
#! /usr/bin/env python
pages = {
"start": {
"text": "It's a dark night outside. Somewhere a wolf howls.",
"prompt": "Where will you take shelter, the haunted house, or the bat cave?",
"next": ("haunted house", "bat cave"),
},
"haunted house": {
"text": "By the light of your flickering torch, you're able to make it to\n" \
Jason Hotchkiss (hotchk55)
We were speaking yesterday on IRC about a couple of designs I want made up, but was having issues with the silkscreen. I found out that the main differences between your CAM and the BatchPCB one I had previously used are as follows:
Top Silkscreen Layer does not include layers 27 tValues, 51 tDocu
Bottom Silkscreen Layer does not include layers 28 tValues 52 bDocu
I also get a couple of warnings
- Warning: Layer ‘Drills’ is active but layer ‘Holes’ is not active. Is this OK?
- Warning: Layer ‘Holes’ is active but layer ‘Drills’ is not active. Is this OK?
%global srcname pidgin-lwqq
Name: %{srcname}
Version: 0.1d
Release: 5%{?dist}
Summary: QQ plugin for Pidgin
Group: Applications/Communications
License: GPLv3+
URL: https://github.com/xiehuc/pidgin-lwqq
Source0: https://github.com/xiehuc/%{srcname}/archive/master.zip
var htmlWidgets = {
'details': '<!-- info pane start --><div id="info_pane"> <h3 id="infoDetails" class="headline" style="font-size: 20px">AUD/USD Details</h3> <p id="atDateAndRate" class="minisubhead">AUD/USD for the 24-hour period ending <span class="date">Sunday, May 19, 2013</span> 22:00 UTC @ </p> <p id="estimatedPrice" class="minisubhead" style="display: none"></p> <div class="spread"> <table> <tr id="sellMyCurrencyRow"> <td id="sellMyCurrency">Selling USD</td> <td style="width: 50px"> <div class="arrow"></div> </td> <td id="sellMyCurrencyGet" class="get">you get AUD</td> </tr> <tr> <td id="buyMyCurrency">Buying AUD</td> <td style="width: 50px"> <div class="arrow"></div> </td> <td id="buyMyCurr
@CapnKernel
CapnKernel / oanda-fetch.py
Last active December 17, 2015 15:59
USD to AUD fetching code
#! /usr/bin/env python
import re
import requests
from lxml import html
import json
import sys
oanda_url = 'http://www.oanda.com/currency/converter/'