Skip to content

Instantly share code, notes, and snippets.

for X in $(find . -name '*.jpg') ; do
echo "${X}" |
sed -E 's|^(./(....)/(..)/........(..)(..)(..)(..).*)|\2 \3 \4 \5 \6 \7 \1|';
done | while read -r Y M D h m s f ; do
exiftool -overwrite_original -exif:all= -F "-make=Nintendo co., ltd" -alldates="$Y:$M:$D $h:$m:$s" "$f"
touch -t "$Y$M$D$h$m" "$f"
done
@hfwang
hfwang / index.js
Last active December 13, 2015 03:58
Javascript (and jQuery) port of Rail's simple_format
function simpleFormat(text) {
text = text.replace(/\r\n?/, "\n");
var paragraphs = text.split(/\n\n+/);
var p, b, blocks;
for (var i = paragraphs.length - 1; i >= 0; i--) {
p = $('<p />').prependTo($e);
blocks = paragraphs[i].split(/\n/);
b = [];
for (var j = 0; j < blocks.length; j++) {

Keybase proof

I hereby claim:

  • I am hfwang on github.
  • I am hfwang (https://keybase.io/hfwang) on keybase.
  • I have a public key whose fingerprint is 1352 0A5B B7F5 F4EC 06D9 9FB0 6BAE 4163 3CCB 05B9

To claim this, I am signing this object:

@hfwang
hfwang / make.sh
Last active August 29, 2015 14:01
#!/bin/sh
# fail fast
set -e
# capture root dir
root=$(pwd)
# change into subdir of archive
cd $root/protobuf-*
@hfwang
hfwang / script.lua
Last active December 30, 2015 15:59
PayDay 2 script
managers.money:_add_to_total(5000000000) -- money
managers.skilltree:_set_points(300) -- skill points
managers.experience:_set_current_level(88) -- level
-- Message on screen
if managers.hud then
managers.hud:show_hint( { text = "LUA script loaded! Complete the mission to see effect." } )
end
for i=1, 7 do managers.lootdrop:debug_drop( 1000, true, i ) end
@hfwang
hfwang / create_models_migration.rb
Created April 10, 2012 18:01
Use Ruby's marshal facilities in ActiveRecord to serialize some attributes for schema-less awesome.
class CreateModels < ActiveRecord::Migration
def change
create_table :models do |t|
t.binary :extras
t.timestamps
end
end
end