Skip to content

Instantly share code, notes, and snippets.

@husjon
husjon / gist:ae88c6e8a94b9aea4b4bb7633d5c135f
Last active September 28, 2020 09:28
`docker_container` published_ports revokal output
╭─ husjon in /tmp/testing
╰─(ノ˚Д˚)ノ ansible-playbook -i hosts playbook.yaml -vvvv
ansible-playbook 2.9.13
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/husjon/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.8.5 (default, Sep 5 2020, 10:50:12) [GCC 10.2.0]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
@husjon
husjon / build.sh
Created February 9, 2020 18:59 — forked from Forst/build.sh
Ubuntu ISO with preseed.cfg generation script
#!/bin/bash
## FORSTWOOF UBUNTU PRESEED :: BUILD SCRIPT
# Quit on first error
set -e
# Temporary directory for the build
TMP="/var/tmp/ubuntu-build"
from pydub import AudioSegment
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtMultimedia import *
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import sys
import time
import math
@husjon
husjon / mpvctl
Created April 4, 2019 18:33 — forked from dwgill/mpvctl
A small script for controlling mpv via the JSON IPC. Intended to resemble playerctl.
#!/usr/bin/env bash
# This script requires:
# - that the directory $HOME/.mpv exist
# - that the program socat be installed
# - that you start mpv with the unix socket feature pointing at that directory
# I recommend an alias in your .bashrc or equivalent file:
# alias mpv="mpv --input-unix-socket=$HOME/.mpv/socket"
socket="$HOME/.mpv/socket"
@husjon
husjon / sample.sh
Created May 12, 2018 13:02 — forked from e7d/sample.sh
Bash "try catch"
#!/bin/bash
export AnException=100
export AnotherException=101
# start with a try
try
( # open a subshell !!!
echo "do something"
[ someErrorCondition ] && throw $AnException
#!/usr/bin/env python3
import argparse
import collections
import json
import os
import requests
token_env_name = 'GIST_TOKEN'
@husjon
husjon / PinDistrictApps.cmd
Created March 30, 2018 19:12 — forked from sirlancelot/PinDistrictApps.cmd
Windows 7 script to pin items to the taskbar. Can be placed in the default user's startup folder. Self-terminating.
@echo off
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Mozilla Firefox\Mozilla Firefox.lnk"
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Word 2007.lnk"
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Excel 2007.lnk"
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office PowerPoint 2007.lnk"
@husjon
husjon / .gitlab-ci.yml
Last active March 16, 2018 12:37
gitlab-runner
# Example
---
stages:
- test
- build
run_all_tests:
stage: test
script:
- nose2
# ~/.oh-my-zsh/custom/workon_cwd.zsh
function workon_cwd {
# Credits to: Harry Marr (https://hmarr.com/2010/jan/19/making-virtualenv-play-nice-with-git/)
cd $@ 2>/dev/null
# Check that this is a Git repo
GIT_DIR=`git rev-parse --git-dir 2> /dev/null`
if [ $? = 0 ]; then
# Find the repo root and check for virtualenv name override
GIT_DIR=`\cd $GIT_DIR; pwd`
PROJECT_ROOT=`dirname "$GIT_DIR"`
@husjon
husjon / README.md
Created March 13, 2018 14:39 — forked from obscurerichard/README.md
Simulates a low bandwidth, high-latency network connection

slow

This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.

slow 3G                   # Slow network on default eth0 down to 3G wireless speeds
slow reset                # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet  with a high latency
slow dsl -b 1mbps         # Simulate DSL with a slower speed than the default

slow modem-56k -d eth0 # Simulate a 56k modem on the eth1 device. eth0 is unchanged.