Skip to content

Instantly share code, notes, and snippets.

View gnuton's full-sized avatar
:shipit:

Antonio Aloisio gnuton

:shipit:
View GitHub Profile
@gnuton
gnuton / gist:6810680
Created October 3, 2013 14:22
Small routine which converts a score to a color. 0.6 is the max value of the score
def color(score, max_score):
# proportion: max_score : 255 = score : x
nrmlzScore = int(score * 255 /max_score)
hueValue = (str(hex(abs(255 - nrmlzScore)))[2:])
colorHexStr = "#%s%s%s" %(hueValue,hueValue,hueValue)
print "%s -> %s" % (score, colorHexStr)
return colorHexStr
@gnuton
gnuton / Android services
Created October 18, 2013 17:54
Android Services in a nutshell
Android services in a nutshell
- Started when startService() is run by a component (activity or broadcast receiver)
-> Service.onStartCommand() runs in the Service
- Service stops when the service calls stopSelf() or a component calls stopService()
- If a component calls bindService() and onStartCommand() is not called
-> Service is stopped when all clients are unbound
- Runs in the application thread unless you don't set a different process name in the manifest file
- The more the service runs the more the service is susceptible to killing because
@gnuton
gnuton / gist:034e9353b51ab5af7ab8
Created January 13, 2016 16:37
Script to connect e3372s-153 stick firmware to internet on Linux
## Reference https://lists.openwrt.org/pipermail/openwrt-devel/2015-July/034094.html
import serial
from subprocess import call
from time import sleep
p='/dev/ttyUSB1'
def toIP(octet):
n=2
ipArray = [int(octet[i:i+n],16) for i in range(0, len(octet), n)][::-1]
@gnuton
gnuton / cve_2016_0728.c
Created January 20, 2016 21:29 — forked from jpouellet/cve_2016_0728.c
cve_2016_0728 exploit
/* $ gcc cve_2016_0728.c -o cve_2016_0728 -lkeyutils -Wall */
/* $ ./cve_2016_072 PP_KEY */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <keyutils.h>
#include <unistd.h>
#include <time.h>
@gnuton
gnuton / README.md
Created February 1, 2016 10:07 — forked from teffalump/README.md
OpenWRT adblock implementation

Others have recently developed packages for this same functionality, and done it better than anything I could do. Use the packages instead of this script:

Description

In its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. In addition, the router will update the blocklist weekly. However, the blocking is leaky, so do not expect everything to be blocked.

@gnuton
gnuton / cool_names.txt
Created January 13, 2017 11:48
Cool Names
Aardwolf
Abdol, Ahmet
Abner Little
Abominable Snowman
Abomination
Abominatrix
Abraxas
Absalom
Absorbing Man
Abyss
@gnuton
gnuton / gist:f3e0c7dd5ce45d5757b14b56e20bd91b
Created December 27, 2017 15:43
Wacom CTH-490 on Linux
Wacom CTH-490
==== List of devices ===
gnuton@Jeremia:~$ xsetwacom --list devices
Wacom Intuos PT S 2 Pen stylus id: 10 type: STYLUS
Wacom Intuos PT S 2 Finger touch id: 11 type: TOUCH
Wacom Intuos PT S 2 Pad pad id: 12 type: PAD
==== Bind buttons to Express keys ====
Express Keys are the 4 keys on the tablet.
@gnuton
gnuton / gist:5704247
Created June 4, 2013 07:36
Android: How to display rich text in a textView
TextView tv = (TextView)findViewById(R.id.mytextview);
Spanned myStringSpanned = Html.fromHtml(myString, null, null);
tv.setText(myStringSpanned, TextView.BufferType.SPANNABLE);
Supporte TAGS on Android 2.1
<a href="...">
<b>
<big>
<blockquote>
<br>
@gnuton
gnuton / gist:6fa12d87a9ee98fdcb74016f1b09fdd0
Created December 5, 2018 14:56
Reading HLA dat files in python.. not complete
#!/usr/bin/python
filename="hla.dat"
alleles= []
OP_BEGIN="ID"
OP_WIDTH=2
LAST=-1
@gnuton
gnuton / gist:afb9867de796459170d8725bb2b4ff4d
Created February 3, 2020 10:32
JS Fetch sniffer v 0.1
// This PoC code can hook into a JS app, and sniff for all REST connections happening
// storing them into local storage
//
// How to use it
// Open crome, press F12 in the page you wanna sniff the connections
// launch
initFetchSniffer()
let response = await fetch(`https://api.github.com/users/gnuton`);
await response.json()
fetchLog()