This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add your index.html file to res/raw | |
| Add dep to app gradle file: | |
| dependencies { | |
| implementation 'org.nanohttpd:nanohttpd-webserver:2.3.1' | |
| } | |
| Java class file: | |
| import fi.iki.elonen.NanoHTTPD; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #create patches from author(s) into one without comments | |
| #good for GPLv2 sharing | |
| for c in `git log --format=format:%H --author=chris`;do git format-patch --stdout --format=format:%H --no-stat -1 $c;done | tee stuff.patch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for f in ./*.*;do convert -resize 1280x720 $f ./720p/$f; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && git pull" \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //1ms but uses file cache so not updated quickly | |
| try { | |
| String inputLine; | |
| FileReader file = new FileReader("/sys/class/power_supply/battery/current_now"); | |
| BufferedReader bufferedReader = new BufferedReader(file); | |
| inputLine = bufferedReader.readLine(); | |
| text = inputLine; | |
| bufferedReader.close(); | |
| file.close(); | |
| } catch (Exception e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From AOSP page: | |
| "Analyzing app startup time | |
| Use $ adb shell am start with the -P or --start-profiler option to run the profiler when your app starts. | |
| This will start the profiler almost immediately after your process is forked from zygote, before any of your code is loaded into it." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In Android Manifest file declare following | |
| <application android:name="com.xyz.MyApplication"> | |
| </application> | |
| then write the class | |
| public class MyApplication extends Application{ | |
| private static Context context; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from twisted.web import server, resource | |
| from twisted.internet import reactor, endpoints | |
| class Counter(resource.Resource): | |
| isLeaf = True | |
| numberRequests = 0 | |
| def render_GET(self, request): | |
| self.numberRequests += 1 | |
| request.setHeader("content-type", "text/plain") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://www.unspecific.com/nmap/ | |
| vi nmap-wrapper.pl --> add $opt_d=3 | |
| $ sudo ./bin/nmap-wrapper.pl -v -l 10.0.0.0/24 | |
| $ nmap-search.pl -f ./20150320.10.0.0.gnmap port 80 | |
| $ nmap-report.pl -p80 -v | |
| #html output | |
| #nmap has a built in xslt stylsheet in xml output, convert to html |