Skip to content

Instantly share code, notes, and snippets.

View ABalanuta's full-sized avatar
🎯
Focusing

Artur Balanuta ABalanuta

🎯
Focusing
View GitHub Profile
@ABalanuta
ABalanuta / OpenWeatherDevice.py
Last active July 27, 2017 18:46
Fake OpenChirp Weather device
#!/usr/bin/env python2.7
"""Gets Temperature and Humidity values
from api.openweathermap.org using the api key"""
__author__ = "Artur Balanuta"
__version__ = "2.0.1"
__email__ = "arturb [at] andrew.cmu.edu"
import signal
@ABalanuta
ABalanuta / ovpn.py
Created February 22, 2016 17:28
Super simple .ovpn file generator for OpenVPN servers without openvpn-as installed to generate it.
import sys, getopt
help = "ovpn.py --host <host> --ca <capath> --crt <certpath> --key <keypath> [--port <port>, --proto <proto>, --options <optionspath>]"
template = """
dev tun
port {{PORT}}
proto {{PROTO}}
remote {{HOST}}
rocommunity public
#Zpool Usage
extend .1.3.6.1.4.1.2021.88 zpool_name /bin/bash -c "sudo zpool list -H -o name"
extend .1.3.6.1.4.1.2021.88 zpool_snap /bin/bash -c "sudo zpool list -Ho name|for strzpool in `xargs`;do sudo zfs get -rHp -o value usedbysnapshots $strzpool|awk -F: '{sum+=$1} END{print sum}';done"
extend .1.3.6.1.4.1.2021.88 zpool_used /bin/bash -c "sudo zpool list -Ho name|xargs sudo zfs get -Hp -o value used"
extend .1.3.6.1.4.1.2021.88 zpool_data_used /bin/bash -c "sudo zpool list -Ho name|for strzpool in `xargs`;do snap=`sudo zfs get -rHp -o value usedbysnapshots $strzpool|awk -F: '{sum+=$1} END{print sum}'`;pool=`sudo zfs get -Hp -o value used $zpool`; echo $pool $snap|awk '{print (\$1-\$2);}';done"
extend .1.3.6.1.4.1.2021.88 zpool_available /bin/bash -c "sudo zpool list -Ho name|xargs sudo zfs get -Hp -o value available"
extend .1.3.6.1.4.1.2021.88 zpool_capacity /bin/bash -c "sudo zpool list -H -o capacity"
#ARC Usage
@ABalanuta
ABalanuta / _etc_modprobe.d_hid_apple.conf
Last active August 29, 2015 14:25
UK International Mac Keyboard Config for ArchLinux
options hid_apple fnmode=2
@ABalanuta
ABalanuta / Makefile
Last active April 22, 2019 23:45
thesisPInstall
all: echo_options
echo_options:
@echo '##Options##'
@echo '0 - Add User/Keys'
@echo '1 - Pre-install'
@echo '1b- Install Firmware with tft support'
@echo '2 - Install Software'
@echo '3 - Install Addicional Gateway Software'
@echo '4 - Get/Clear Application'
@ABalanuta
ABalanuta / Force-MyEduroam5Ghz.sh
Created June 7, 2014 05:03
Force-MyEduroam5Ghz Forces Gnome NetworkManager to connect to the stronngest eduroam AP at 5Ghz
USER="myPcUser"
ID="ist1xxxxx@tecnico.ulisboa.pt"
INTERFACE="wifi0"
PC_MAC="12:34:56:78:90:AB"
CERT_PATH="/home/MY_CERT_PATH/.cacert.pem"
D="/etc/NetworkManager/system-connections/eduroam"
FPATH=$(echo "/tmp/"$(date | sha1sum | awk '{print $1}'))
iwlist $INTERFACE scan | grep '"eduroam"' -B5 | grep "Frequency:5" -A1 -B2 > $FPATH
import sys
import xml.etree.ElementTree as ET
if len(sys.argv) < 2:
print "Usage \n\tpython "+ sys.argv[0]+ " file.xml"
exit()
else:
filename = sys.argv[1]
print "\nUsing file: "+filename+" \n"