Skip to content

Instantly share code, notes, and snippets.

View crossle's full-sized avatar
🌐

Crossle Song crossle

🌐
View GitHub Profile
@crossle
crossle / repo-switch
Created September 27, 2013 16:12
Convenient switch AOSP git repo
#!/bin/bash
while read LINE
do
echo $LINE
cd $LINE
`git checkout android-4.3_r1.1`
cd -
done < .repo/project.list
#define RANDOM(x) (rand()%x)
#define MAC_ADDR_LENGTH 6
void macGen() {
uint8_t HEXCHAR[256];
uint8_t MACAddr[MAC_ADDR_LENGTH];
for (int j = 0; j < 256; j ++) {
HEXCHAR[j] = j;
}
@crossle
crossle / DoubleTouchScrollView
Created January 17, 2013 08:31
ScrollView contain a TextView who had a scrollbar
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ScrollView;
public class CustScrollView extends ScrollView {
public CustScrollView(Context context) {
super(context);
}
@crossle
crossle / clear_log.rb
Last active December 11, 2015 04:28
Clear Rail log in development env only cp it to Rails.root/config/initializers/
if Rails.env.development?
MAX_LOG_SIZE = 10.megabytes
logs = [File.join(Rails.root, 'log', 'development.log'), File.join(Rails.root, 'log', 'test.log')]
logs.each do |log|
if File.size?(log).to_i > MAX_LOG_SIZE
$stdout.puts "Remove Log: #{log}"
`rm #{log}`
end
end
@crossle
crossle / install_theos.sh
Created October 21, 2015 08:51 — forked from tom-go/install_theos.sh
Theos install script
#!/bin/bash
export THEOS=/opt/theos
# clone theos.git
cd /opt
git clone git://github.com/DHowett/theos.git
# clone iphoneheaders.git
cd $THEOS
mv include include.bak
productbuild --component xxx.app /Applications --sign "3rd Party Mac Developer Installer:" xxx.pkg
@crossle
crossle / gist:1de535e6a1d3f9fd48e6
Created May 26, 2015 06:59
libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
brew install exiftool
find . -path '*src/main/res/*' -name '*.png' -exec exiftool -overwrite_original -all= {} \;
@crossle
crossle / ffmpeg_cmd_watermark.sh
Last active August 29, 2015 14:16
ffmpeg add watermark
input="$1"
output="$2"
ffmpeg -i "$input" -vf "movie=watermark.png [watermark]; [in][watermark] overlay=10:10 [out]" -vsync 2 -bsf:a aac_adtstoasc -acodec copy "$output"
@crossle
crossle / sonatype_create_repo
Created January 13, 2015 05:54
Sonatype create repo
http://central.sonatype.org/pages/ossrh-guide.html#create-a-ticket-with-sonatype
@crossle
crossle / gist:d8064c69fbd4b70f3f84
Created December 24, 2014 02:39
Merge multi file to one file
find -name "*.java" -exec 'cat' {} \; > a.txt