Skip to content

Instantly share code, notes, and snippets.

View bast's full-sized avatar
🦀
rusting

Radovan Bast bast

🦀
rusting
View GitHub Profile
import csv
import sys
import click
@click.command()
@click.option('--file-name', help='Input file (file is not modified).')
@click.option('--index', help='Insert column at this position (starts at 0).')
@click.option('--column-name', help='Column name.')
def main(file_name, index, column_name):
@bast
bast / bootable-usb.sh
Last active January 10, 2020 09:50
Create bootable USB from command line.
# adapted from https://web.archive.org/web/20190522110737/https://antergos.com/wiki/uncategorized/create-a-working-live-usb/
# first find out the device of your usb
sudo fdisk -l
# now that you know the letter, replace the "X" below
# typically "X" is replaced by "b" or "c" but it can be different on your system
# make sure it's not the device of your hard drive, otherwise you wipe it
sudo dd bs=4M if=/path/to/image.iso of=/dev/sdX status=progress
sync
@bast
bast / install-sonar.sh
Created August 15, 2019 14:39
Sonar installation on Stallo
#!/usr/bin/env bash
module purge
source /global/work/sonar/python/environment
pyenv shell 3.6.7
python --version
git clone https://github.com/uit-no/sonar.git github-sources
@bast
bast / python-install.sh
Created December 9, 2018 16:16
How to compile your own Python with OpenSSH support.
#!/usr/bin/env bash
openssl_version="1_1_0f"
python_version="3.7.0"
_here=$PWD
mkdir -p ${_here}/tmp
cd ${_here}/tmp
wget https://github.com/openssl/openssl/archive/OpenSSL_${openssl_version}.tar.gz
@bast
bast / delete-appveyor-cache.sh
Created July 20, 2018 14:40
Delete Appveyor cache using curl.
#!/usr/bin/env bash
# adjust APPVEYOR_TOKEN, username, and projectname
APPVEYOR_TOKEN=....................
curl -H "Authorization: Bearer $APPVEYOR_TOKEN" \
-H "Content-Type: application/json" \
-X "DELETE" \
https://ci.appveyor.com/api/projects/username/projectname/buildcache
@bast
bast / ssh-fingerprints.sh
Created June 21, 2018 12:54
Script to get SSH key fingerprints for a trusted hostname.
#!/usr/bin/env bash
hostname=$1
echo "SSH key fingerprints for hostname: $hostname"
echo "hexadecimal format"
ssh-keygen -lf <(ssh-keyscan -t rsa $hostname 2> /dev/null) -E md5
ssh-keygen -lf <(ssh-keyscan -t ecdsa $hostname 2> /dev/null) -E md5
@bast
bast / rdp-to-azure-windows-vm.sh
Created April 12, 2018 17:27
How to connect to Azure Windows VM from Linux command line
$ xfreerdp /u:youruser /v:yourip /w:2560 /h:1440 /p:yourpassword /cert-ignore &
@bast
bast / scipy-interpolate.py
Last active January 24, 2018 10:39
2D spline interpolation example using SciPy.
import sys
from math import exp
import numpy as np
from scipy.interpolate import RectBivariateSpline
import random
from time import time
def f(x, y):
return exp(-(2.0*x)**2.0 - (y/2.0)**2.0)
@bast
bast / language-stats.py
Created January 16, 2018 11:24
Extracts programming language statistics from our registration data.
import csv
import glob
from collections import Counter
languages = [
'Matlab',
'R',
'Python',
'Perl',
'C',
@bast
bast / onclick-canvas.py
Last active January 24, 2018 10:55
Allows to interactively draw a new polygon based on an existing polygon.
"""
Allows to interactively draw a new polygon based
on an existing polygon.
"""
import sys
import matplotlib.pyplot as plt
in_file = sys.argv[-2]
out_file = sys.argv[-1]