Skip to content

Instantly share code, notes, and snippets.

View cmavr8's full-sized avatar

Chris Mavrakis cmavr8

View GitHub Profile
@cmavr8
cmavr8 / mfwifi
Last active August 29, 2015 13:58
TU/e MetaForum WiFi enabler/disabler
#!/bin/bash
# TU/e MetaForum WiFi enabler/disabler
# By Chris Mavrakis
#
# Usage:
# sudo mfwifi [enable|disable|setup]
#
# setup should be run only once, the first time. It asks for TU/e credentials,
# does not send them back to me, and creates the appropriate files in /etc/network
@cmavr8
cmavr8 / gnome shortcuts
Created March 26, 2013 19:10
I had this bug's problem (https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/990727) and also the fact that my shortcuts are "forgotten" on each reboot. So I made this script that is run upon login and restores my custom shortcuts.
#!/bin/bash
echo "Doing..."
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-down "['<Primary><Alt>s']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-left "['<Primary><Alt>a']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-right "['<Primary><Alt>d']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-up "['<Primary><Alt>w']"
@cmavr8
cmavr8 / z370Power
Created December 6, 2012 16:57
Power optimization script for the Lenovo Ideapad Z370a
#!/bin/sh
# Power optimization script for the Lenovo Ideapad Z370a. Written by Chris Mavrakis (cmavr8@gmail.com).
# Place in /usr/lib/pm-utils/power.d and make executable.
case $1 in
false) # On AC power!
# Intel HD audio power management:
@cmavr8
cmavr8 / ocsusers.sh
Last active October 1, 2015 01:28
Examine OCS (Open Conference Systems) users
#!/bin/bash
# Little script to examine a PKP OCS user database. Instructions:
# 1. Login to OCS and export the users as an xml
# 2. Convert the file to CSV using e.g. Stylus studio 2011 XML Enterprise Suite
# 3. Change this line:
INPUT=users.csv
# 4. Run the script
@cmavr8
cmavr8 / autoyumaconf.sh
Created February 10, 2012 22:43
Dirty script to automate making and installing code to NETCONF server - using YUMA tools
#!/bin/bash
# Script to automate making and installing C++ code to NETCONF server config, based on a YANG module file (module_name.yang). Created by Chris Mavrakis <sec@cmavrakis.com>, 21-Nov-2011.
# The code is messy and does not do ANY checks... so be careful. Inspect it yourself before using it, I will have no responsibility if something bad happens. Info about YANG, YUMA etc can be found here: http://www.netconfcentral.org
### Please edit the following two options:
### 1. What is the name of your Module? This should be your filename's first part (before the ".yang")
MODULENAME=MYMODULE
@cmavr8
cmavr8 / nm-watchdog
Created September 19, 2011 13:41
Simple watchdog script to make sure NetworkManager applet is always running. Nm-applet is restarted after it's exited due to bugs etc.
#!/bin/bash
#This script makes sure nm-applet is always running.
echo "Initiating script (`date`)" > /tmp/nm-watchdog
while [ 1 == 1 ]
do
#echo "Checking..." >> /tmp/nm-watchdog
tmp=`ps -e |grep nm-applet`
if [[ "$tmp" == '' ]]
then
export DISPLAY=':0.0'
@cmavr8
cmavr8 / mute
Created September 19, 2011 13:39
Mute/Unmute microphone on a Lenovo X201s
#!/bin/bash
#Map this script to a button (eg F1) to mute your mic while VoIPing
currentlevel=`amixer get Capture |grep "Front Left:" | awk '{ print ($5) }'`
if [ $currentlevel == '[100%]' ]; then
amixer set Capture 0
echo "Mic muted" >> /tmp/mutelog
elif [ $currentlevel == '[0%]' ]; then
amixer set Capture 100
echo "Mic unmuted" >> /tmp/mutelog
else
@cmavr8
cmavr8 / power
Created June 11, 2011 13:38
Laptop power saving - for a Lenovo X201s running Ubuntu 11.04
#!/bin/bash
rfkill block bluetooth
iwconfig wlan0 power on
iwconfig wlan0 txpower 30mW
iwconfig wlan0 power timeout 500ms
killall dropbox
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor