Skip to content

Instantly share code, notes, and snippets.

@dabio
dabio / gist:9929590
Last active August 29, 2015 13:58
Create small Images, Thumbnails and Rename
mogrify -filter spline -adaptive-resize 1600x -unsharp 0x1 *.JPG
mogrify -filter spline -resize 616x -unsharp 0x1 -path thumbs *.JPG
for files in *.JPG
do
mv "$files" "${files%.JPG}.jpg"
done
- (void)removeOldDatabase
{
if (![[[NSUserDefaults standardUserDefaults] objectForKey:@"parku-3.0.0"] boolValue]) {
NSURL *storeURL = [NSPersistentStore MR_defaultLocalStoreUrl];
NSError *error;
[[NSFileManager defaultManager] removeItemAtPath:storeURL.path error:&error];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"parku-3.0.0"];
}
}

Keybase proof

I hereby claim:

  • I am dabio on github.
  • I am dabio (https://keybase.io/dabio) on keybase.
  • I have a public key whose fingerprint is F140 D335 981E 7AE2 8357 49A8 5B1E E898 A4C2 D9D3

To claim this, I am signing this object:

def timesince(d, now=Time.now)
delta = (now - d.to_time).to_i
return '0 Minuten' if delta <= 60
chunks = [
[60 * 60 * 24 * 356, 'Jahr', 'Jahre'],
[60 * 60 * 24 * 30, 'Monat', 'Monate'],
[60 * 60 * 24 * 7, 'Woche', 'Wochen'],
[60 * 60 * 24, 'Tag', 'Tage'],
[60 * 60, 'Stunde', 'Stunden'],
@dabio
dabio / gist:834429
Created February 18, 2011 21:18
force encoding for cuba
# Fixes encoding issue by defaulting to UTF-8
def force_encoding(data, encoding = 'UTF-8')
if data.respond_to? :force_encoding
data.force_encoding encoding
elsif data.respond_to? :each_value
data.each_value { |v| v.force_encoding(encoding) }
elsif data.respond_to? :each
data.each { |v| v.force_encoding(encoding) }
end
data
@dabio
dabio / gist:1681463
Created January 26, 2012 07:05
Uninstall all ruby gems
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
@dabio
dabio / configure_liblo_iphone.sh
Created February 3, 2012 12:21 — forked from mikewoz/configure_liblo_iphone.sh
Configure liblo for iOS 5.0
./configure \
--host="arm-apple-darwin" \
--enable-static \
--disable-shared \
--disable-dependency-tracking \
CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-cpp-4.2 \
CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-cpp-4.2 \
CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc\
AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar \
@dabio
dabio / gist:3359894
Created August 15, 2012 12:51
Drop all tables of a database
mysql -Nse 'SHOW TABLES' [database] | while read table; do mysql -e "DROP TABLE $table;" [database]; done
@dabio
dabio / gist:3359898
Created August 15, 2012 12:52
Truncate all tables of a database
mysql -Nse 'SHOW TABLES' [database] | while read table; do mysql -e "TRUNCATE TABLE $table;" [database]; done
@dabio
dabio / gist:4239163
Created December 8, 2012 07:50 — forked from nickjenkin/gist:3175420
Golang Solr result xml parser
package solr
import (
"encoding/xml"
)
type SolrResponse struct {
Results SolrResults `xml:"result"`
}