Skip to content

Instantly share code, notes, and snippets.

@michaelpeternell
michaelpeternell / retina2nonretina.pl
Created June 2, 2014 16:14
Convert retina graphics to non-retina graphics, for iOS
#! /usr/bin/perl
# by Michael Peternell
# Created: 23. Okt. 2012
# Version 0.2
use strict;
use Cwd qw(abs_path);
#use Getopt::Long;
@michaelpeternell
michaelpeternell / refactor.pl
Created June 2, 2014 16:12
Search and replace on a whole directory
#!/usr/bin/perl
# by Michael Peternell
# Created: 2013
# Last modified: 2013
# Search and replace on a whole directory.
# filenames are also searched and replaced.
# recursive.
# (Git files are excluded from the search. (when filename contains ".git"))
@michaelpeternell
michaelpeternell / cobc_fix_install.pl
Last active August 29, 2015 14:02
Dirty hotfix for broken GNU Cobol / Macports package
#!/usr/bin/perl
#by Michael Peternell
#Created: 2014-May-30
# this fixes the broken open-cobol package on macports on OSX 10.8+
# this is a dirty hack, use at your own risk.
# see also:
# https://sourceforge.net/p/open-cobol/discussion/help/thread/e1b4af35/
use strict;
@michaelpeternell
michaelpeternell / gnucoboltest001.sh
Created May 29, 2014 15:32
Simple test case to check if GNU Cobol is actually installed
#!/bin/bash
# Created: 2014-May-29
# by Michael Peternell ( michael dot peternell at gmx dot at )
# License: you may use it if you promise to never ever sue me for anything
# anytime, even if this script causes your computer to explode ;)
# This test case succeeds (returns 0) if the GNU Cobol compiler (cobc) is
# installed and if it can compile a simple hello world program
@michaelpeternell
michaelpeternell / ios7_statusbar_textcolor
Last active July 15, 2020 17:58
Change the text color of the status bar on iPhone and iPad (works for iOS 7 - iOS 12)
/// sets the status bar text color. returns YES on success. currently, this only
/// works in iOS 7. It uses undocumented, inofficial APIs.
BOOL setStatusBarColor(UIColor *color)
{
id statusBarWindow = [[UIApplication sharedApplication] valueForKey:@"statusBarWindow"];
id statusBar = [statusBarWindow valueForKey:@"statusBar"];
SEL setForegroundColor_sel = NSSelectorFromString(@"setForegroundColor:");
if([statusBar respondsToSelector:setForegroundColor_sel]) {
// iOS 7+
@michaelpeternell
michaelpeternell / ios_scale_app_icon
Last active August 29, 2015 14:00
XCode build script for iOS Apps to generate all sizes of app icons from one 1024*1024 master app icon
# Generate all icon files from Icon_1024.png
#smaller app store icon
sips --resampleWidth 512 Icon_1024.png --out Icon_512.png
#iphone icons
sips --resampleWidth 114 Icon_1024.png --out Icon\@2x.png
sips --resampleWidth 57 Icon_1024.png --out Icon.png
#ipad icons