Skip to content

Instantly share code, notes, and snippets.

View andli's full-sized avatar

Andreas andli

View GitHub Profile
#!/usr/bin/perl
use strict;
use warnings;
use POSIX qw(strftime);
use Time::HiRes qw(gettimeofday usleep);
my $dev = @ARGV ? shift : 'eth0';
my $dir = "/sys/class/net/$dev/statistics";
@andli
andli / install-mtgo-ubuntu.sh
Last active October 1, 2018 13:26
Docker MTGO
sudo apt install docker.io -y
sudo usermod -aG docker $USER
#Relog to apply usermod
wget -O run-mtgo https://raw.githubusercontent.com/pauleve/docker-mtgo/master/run-mtgo
chmod +x run-mtgo
./run-mtgo
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
scoop install 7zip git concfg
concfg import solarized-dark
# scoop install pshazz
# For admin powershell prompt
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
@andli
andli / provision.sh
Last active December 12, 2018 15:27
Provision new debian based workstation
#!/usr/bin/env bash
# chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google.list
# etcher.io
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61
echo "deb https://dl.bintray.com/resin-io/debian stable etcher" | sudo tee /etc/apt/sources.list.d/etcher.list
sudo apt update
@andli
andli / toggleinput.sh
Last active September 5, 2022 19:34
Toggle input source of Dell U2715H (or other i2c enabled monitors) from keyboard shortcut
#!/bin/bash
#sudo cp toggleinput.sh /usr/local/bin/toggleinput
#chmod 755
#chown root:root
#set as keyboard shotcut target
#elevate to root if necessary
if test "$(id -u)" -ne 0 ; then
sudo "$0" "$1"
@andli
andli / update-pip.py
Last active January 26, 2018 09:33
Update all pip packages
import pip
from subprocess import call
packages = [dist.project_name for dist in pip.get_installed_distributions()]
call("pip install --upgrade " + ' '.join(packages), shell=True)