Skip to content

Instantly share code, notes, and snippets.

View andli's full-sized avatar

Andreas andli

  • Sectra
  • Sweden
View GitHub Profile
@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)
@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 / 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
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 / 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
#!/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";
#!/bin/bash
IF=$1
if [ -z "$IF" ]; then
IF=`ls -1 /sys/class/net/ | head -1`
fi
RXPREV=-1
TXPREV=-1
echo "Listening $IF..."
while [ 1 == 1 ] ; do
RX=`cat /sys/class/net/${IF}/statistics/rx_bytes`
@andli
andli / showseriesdatalabels.vba
Created May 10, 2019 13:27
Edit all data labels in an Excel graph to show series name
Sub datalabels()
For Each myChart In ActiveSheet.ChartObjects
For Each mySrs In myChart.chart.SeriesCollection
With mySrs
If Not .HasDataLabels Then
.ApplyDataLabels
End If
.datalabels.ShowSeriesName = True
@andli
andli / scripts.ahk
Last active January 27, 2022 14:07
My AutoHotKey script collection
#Requires AutoHotkey v2-
#SingleInstance force
;#Warn All, Off
; Type some characters that are not easily available on your keyboard.
:?*:,oe::ø
:?*:,OE::Ø
; Mutes an MS Teams meeting by sending ctrl-shift-m to it. Needs to be focused to work.
Scrolllock::
(Get-FileHash .\file.zip -Algorithm sha256).Hash -eq 'XXXXXX'