Skip to content

Instantly share code, notes, and snippets.

@jjsahalf
jjsahalf / folder_splitter.py
Created May 2, 2017 15:51 — forked from zupo/folder_splitter.py
Split a folder with many files into subfolders with N files. Usage: python folder_splitter.py path/to/target/folder
# -*- coding: utf-8 -*-
# @author: Peter Lamut
import argparse
import os
import shutil
N = 10 # the number of files in seach subfolder folder
@jjsahalf
jjsahalf / presentation.txt
Last active April 10, 2017 20:33
Presentation
http://www.ieee-security.org/TC/SP2016/slides/24-3/papernot.pdf
https://www.tensorflow.org/get_started/mnist/beginners
https://flic.kr/p/SsuSM3
https://flic.kr/p/SsuSC5
https://zh.wikipedia.org/wiki/%E7%9F%A9%E9%98%B5
@jjsahalf
jjsahalf / file-open-read-write-replace.py
Last active March 29, 2017 19:54
Basic file open, read, write, replace operations.
import os, sys
os.system("find "+sys.argv[1]+" -type f > "+sys.argv[1]+"/namelist")
writeFile=open(sys.argv[1]+"/output", "w")
with open(sys.argv[1]+"/namelist") as f:
for line in f:
arr=line.split(".")
newLine=arr[1][1:]
newLine=newLine.replace("/", ".")
if newLine == "namelist":
@jjsahalf
jjsahalf / parameter-and-string-cut.sh
Created March 29, 2017 19:12
Parameter and String Cut
if [ "${1:(-3)}" == "dex" ]; then
./d2j-dex2jar.sh $1
if [ -f "classes-dex2jar.jar" ]; then
echo "moving classes-dex2jar.jar..."
mv ./classes-dex2jar.jar $2
fi
if [ -f "classes-error.zip" ]; then
echo "moving classes-error.zip..."
mv ./classes-error.zip $2
fi
@jjsahalf
jjsahalf / check-file-existence.sh
Created March 26, 2017 22:06
stream editor (sed) and basic string operations
#!/bin/bash
ls | grep _logs |sed 's/_logs//g' | while read line
do
echo $line
v1="${line}_logs/${line}_white_list"
v2="${line}_logs/${line}_class_white_list"
if [ -f $v1 ]; then
echo "${v1} exists"
else
echo "${v1} does not exist!"
@jjsahalf
jjsahalf / handy-shell-2.sh
Last active April 25, 2017 00:17
handy shell 2
#!/bin/bash
cd ../runnableJar/target/sootOutput/
v=$(find . -name "*apk")
cd ../../../Done/
for line in $v
do
echo $(pwd)
echo $line
cp -v $line /data/RedDroid/evaluation/original/
done
@jjsahalf
jjsahalf / handy-shell-1.sh
Last active March 23, 2017 00:28
handy-shell-1
#!/bin/bash
find . -name "*apk" | while read line
do
cp -v $line /data/RedDroid/evaluation/withAndroidPackage/
done
@jjsahalf
jjsahalf / make-flashlight-work-on.yosemite.md
Last active August 30, 2015 20:59 — forked from selaromi/make-flashlight-work-on.yosemite.md
Steps to make Flashlight work on 10.10.4 (doesn't work for El Capitan)

Make Flashlight work on 10.10.4

  1. Install SIMBL http://culater.net/software/SIMBL/SIMBL.php
  2. Copy SpotlightSIMBL.bundle to /Library/Application Support/SIMBL/Plugins/ (a)
  3. Copy Flashlight.osax to ~/Library/ScriptingAdditions/ (b)
  4. Disable Flashlight
  5. Enable Flashlight
  6. Open Script Editor on your Mac (look for "Script Editor In Spotlight") and paste the following code (don't change Snow Leopard for Yosemite)
tell application "Spotlight" to inject SIMBL into Snow Leopard
@jjsahalf
jjsahalf / .gitignore
Last active August 29, 2015 14:25 — forked from kogakure/.gitignore
Git: .gitignore file for LaTeX projects
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl