Skip to content

Instantly share code, notes, and snippets.

View christoph-jerolimov's full-sized avatar

Christoph Jerolimov christoph-jerolimov

View GitHub Profile
@christoph-jerolimov
christoph-jerolimov / tabsample.xml
Created October 9, 2010 10:15
Android TabHost TabWidget TabContent widget sample
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
@christoph-jerolimov
christoph-jerolimov / SdcardFolder.java
Created January 10, 2011 11:33
Load Android SDCard Folder for different devices (Android Standard, Samsung Galaxy S, HTC Incredible)
private String getSdcardFolder() {
File externalStorage = Environment.getExternalStorageDirectory();
if (externalStorage.exists() && externalStorage.canWrite()) {
File trySubDir1 = new File(externalStorage, "external_sd");
File trySubDir2 = new File(externalStorage, "sd");
if (trySubDir1.exists() && trySubDir1.canWrite()) {
return trySubDir1.getAbsolutePath();
} else if (trySubDir2.exists() && trySubDir2.canWrite()) {
return trySubDir2.getAbsolutePath();
} else {
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
public class LazyStartingInputStream extends FilterInputStream {
private final byte[] startingAfter;
private int foundAlready = 0;
@christoph-jerolimov
christoph-jerolimov / fixit.sh
Created May 6, 2012 15:27
GetMama remove script
#!/bin/bash
#
# Copyright 2012 Christoph Jerolimov, Dominik Schilling
#
# 0) No, i did not developed this for myself/my server. ;-)
# 1) I strongly recommend you to reinstall all your server software,
# inclusive the whole operating system like linux, unix, etc. If you
# use a web hosting service, backup your data and request your
# provider for a fresh system. If this is not possible feel free to
# try this script.
// javascript reimplementation of
// https://github.com/hellozimi/HCYoutubeParser/blob/master/YoutubeParser/Classes/HCYoutubeParser.m
var url = require('url');
var http = require('http');
var videoId = '7qpvjsMaXPE';
var infoUrl = 'http://www.youtube.com/get_video_info?video_id=' + videoId;
@christoph-jerolimov
christoph-jerolimov / gist:5789662
Last active December 18, 2015 13:28
Enable the black 2D OSX Dock theme.
#defaults delete com.apple.dock
defaults write com.apple.dock no-glass -integer 1 # <= 10.8 sets the black 2D theme
#defaults write com.apple.dock autohide -string -1 # sure
killall Dock
#defaults delete com.apple.dock persistent-apps # remove all apps, should be used after reorder at least one :D
@christoph-jerolimov
christoph-jerolimov / $CUSTOMERNAME-log
Last active December 18, 2015 23:29
This script shows a grouped (by date), ordered commit list of multiple git repositories.
#!/bin/bash
allgits=`find ~/.cocoapods/CUSTOMERNAME ~/git/CUSTOMERNAME -name .git | sed 's_/.git__'`
filter=$*
filter="$filter --author=jerolimov"
filter="$filter --date=iso"
filter="$filter --after=2013-05-01"
filter="$filter --before=2013-05-31"
for i in $allgits
@christoph-jerolimov
christoph-jerolimov / git-afterwards
Last active December 3, 2021 20:41
Initialize a git repository afterwards with separate commits based on the file modified timestamp. Simple run git init && git afterwards
#!/bin/bash
IFS=$(echo -en "\n\b")
# Ensure we are in a git repo with gitignore.
if [ ! -d .git ]; then echo "Current working directory is not a git repository."; exit -1; fi
#if [ ! -f .gitignore ]; then echo "Current working directory has no .gitignore file."; exit -2; fi
# Sort (by date) and save new files
for file in `git status --porcelain --untracked-files=all | grep -v '.log$' | grep '^?? ' | sed 's/^?? //g'`
do
@christoph-jerolimov
christoph-jerolimov / create-chroot-darwin.sh
Last active October 12, 2019 15:17
Create a OSX chroot ... not finished... works partly, but neighter network nor node.js :S
#!/bin/bash
#set -e
jail="jail"
if [ -e "$jail" ]; then
echo Folder already exists: "$jail"
exit -1
fi
@christoph-jerolimov
christoph-jerolimov / killsim.sh
Last active December 24, 2015 20:29
Kill iPhone Simulator. First friendly, afterwards not so friendly.
if ! pgrep "iPhone Simulator"; then
exit 0;
fi
pids=$(pgrep "iPhone Simulator")
osascript -e 'tell app "iPhone Simulator" to quit'
sleep 1
for pid in $pids; do
if ps $pid; then