Skip to content

Instantly share code, notes, and snippets.

View netbrain's full-sized avatar
🤔

Kim Eik netbrain

🤔
View GitHub Profile
@netbrain
netbrain / gist:eca4bb501a0a4764833c705d6ebf0014
Last active January 27, 2020 06:09
various image oprations
//dump jpeg
curl "http://10.41.3.120/cgi-bin/faststream.jpg?stream=MxPEG&fps=0.1" | mxgconv_linux format=jpeg,of=img
//split images
find ./ | grep jpg |xargs -I@ convert -quality 100 -crop 640x480 @ @_cropped_%d.jpg
//preserve original filename in images
ls | xargs -I@ echo exiftool -Comment=@ @
//rename file to md5sum name
@netbrain
netbrain / spit-test-train.sh
Last active January 27, 2020 06:12
Create test/train set example
#!/bin/bash
find /path/to/JPEGImages | grep jpg$ | shuf > files.list
cat files.list | wc -l
#180 = 10%
cat files.list | head -n 180 > test.txt
#rest goes into train.txt
cat files.list | grep -v -f test.txt > train.txt
@DylanLacey
DylanLacey / loadimg.sh
Last active May 13, 2016 21:45
Load an image onto an Android emulator
#!/bin/bash
cd $ANDROID_HOME/platform-tools
echo `adb devices`
curl -O http://i.imgur.com/0H5GsQV.png
adb push 0H5GsQV.png /sdcard/Download
echo $ANDROID_HOME
@DylanLacey
DylanLacey / fetch_photos.sh
Last active May 19, 2016 08:32
DoThePhotoThing
#!/bin/bash
#! /bin/bash
# Wait until the simulator is running before we try to add the file
simulator=$(ps aux | grep launchd_sim | grep -v grep)
while [ -z "$simulator" ]
do
echo Sleeping for 5
sleep 5
@kyleturner
kyleturner / Remove Submodule
Created January 5, 2012 01:07
How to remove a submodule from a Github project
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.