I hereby claim:
- I am miguel-amaral on github.
- I am miguelamaral (https://keybase.io/miguelamaral) on keybase.
- I have a public key ASAIs9Y3FGVCrnr6JDb35gdELL4Z9EJayDjMFo8CEmdlkQo
To claim this, I am signing this object:
var blue = require("bluetoothctl"); | |
var sleep = require('sleep'); | |
blue.Bluetooth() | |
blue.on(blue.bluetoothEvents.Controller, function(controllers){ | |
console.log('Controllers:' + JSON.stringify(controllers,null,2)) | |
}); | |
import subprocess | |
# from Command import Command | |
from time import sleep | |
class CreateConnectionToWifi(): | |
def run(self): | |
while True: | |
# for x in range(3): |
for n in notifications: | |
notification_file = self.SERVICES_PATH + n['service'] + "/notifications" | |
lock = filelock.FileLock(notification_file + '.lock') | |
try: | |
with lock.acquire(): | |
with open(notification_file, 'w') as file: | |
try: | |
content = json.loads(file.read()) | |
except: | |
content = [] |
some_command | |
if [ $? -eq 0 ]; then | |
echo OK | |
else | |
echo FAIL | |
fi |
# given the following data | |
mydata=(a b c "hello world") | |
for val in a c hello "hello world" | |
do | |
# get line # of 1st matching entry | |
ix=$( printf "%s\n" "${mydata[@]}" | grep -n -m 1 "^${val}$" | cut -d ":" -f1 ) | |
if [[ -z $ix ]] | |
then |
process.stdin.resume();//so the program will not close instantly | |
function exitHandler(options, err) { | |
if (options.cleanup) console.log('clean'); | |
if (err) console.log(err.stack); | |
if (options.exit) process.exit(); | |
} | |
//do something when app is closing | |
process.on('exit', exitHandler.bind(null,{cleanup:true})); |
# flush current rules (might not apply) | |
#iptables -t nat -L | |
# 80 -> 8080 | |
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080 | |
# 443 -> 8443 | |
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 443 -j REDIRECT --to-port 8443 |
grep -o -P "[9][0-9]{8}" fine_name | uniq |
echo "Usage sudo redirect.sh http_port https_port" | |
http_port=$1 | |
https_port=$2 | |
re='^[0-9]+$' | |
if ! [[ $http_port =~ $re ]] ; then | |
echo "error: HTTP PORT Not a number" >&2; exit 1 | |
fi | |
if ! [[ $https_port =~ $re ]] ; then |
I hereby claim:
To claim this, I am signing this object: