Skip to content

Instantly share code, notes, and snippets.

@kidmose
kidmose / virsh-restore-all.sh
Last active April 20, 2019 14:22
Scripts for automating libvirt guest save and restore
#!/bin/bash
# restore all hosts from saved stated (ram image) and start
virsh list --all | `#list of all guest` \
tail -n +3 | head -n -1 | sed 's/\ \+/\t/g' | `#strip head and tail, use tab for seperator`\
awk '{print($2)}' | \
while read GUEST; do
echo "Restoring $GUEST"
virsh restore "/var/lib/libvirt/images/$GUEST/state" --running
echo "Marking $GUEST for autostart"
@kidmose
kidmose / .gitignore
Last active August 29, 2015 14:20
Simple linux ressource usage logging
*

Keybase proof

I hereby claim:

  • I am kidmose on github.
  • I am kidmose (https://keybase.io/kidmose) on keybase.
  • I have a public key whose fingerprint is 1E90 04B7 3855 5F04 92B5 AD61 788C 75A4 01CD 0087

To claim this, I am signing this object:

@kidmose
kidmose / modify_url_to_zorac.js
Last active September 25, 2020 10:00
Bookmarklet that modifies the current url by appending a string: useful for accessing Aalborg University Library paid services from outside
# Slices a string into the url:
# - from eg.: http://link.springer.com/chapter/10.1007/978-3-642-31217-5_19#page-1
# - to eg.: http://link-springer-com.zorac.aub.aau.dk/chapter/10.1007/978-3-642-31217-5_19#page-1
# - subdomains at target are eliminate by replacing `.` with `-`
javascript: (function() {
wl = window.location.toString().split("/");
wl[2] = wl[2].replace(/\./g , "-") + ".zorac.aub.aau.dk";
window.location = wl.join("/");
})()
@kidmose
kidmose / .bashrc
Last active September 19, 2019 10:24
bash config
export EDITOR="emacs"
# <copy> source="http://stackoverflow.com/questions/9457233/unlimited-bash-history">
# Eternal bash history.
# ---------------------
# Undocumented feature which sets the size to "unlimited".
# http://stackoverflow.com/questions/9457233/unlimited-bash-history
export HISTFILESIZE=
export HISTSIZE=
export HISTTIMEFORMAT="[%F %T] "
@kidmose
kidmose / Dockerfile
Last active September 2, 2016 21:56
Dockerfile for docker image with docker and bash - because offical docker docker image from docker doesn't have bash
FROM debian:jessie
MAINTAINER Egon Kidmose
RUN set -x && \
apt-get update && \
apt-get install -y --no-install-recommends apt-transport-https ca-certificates && \
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
echo 'deb https://apt.dockerproject.org/repo debian-jessie main' > /etc/apt/sources.list.d/docker.list && \
apt-get update && \
apt-get install docker-engine -y --no-install-recommends
/var/log/suricata/eve.json {
rotate 10
size 100M
nocompress
missingok
create
sharedscripts
postrotate
/bin/kill -HUP $(cat /var/run/suricata.pid)
endscript
@kidmose
kidmose / iwlist-scan-to-csv.sh
Last active October 12, 2016 19:56
Converts output of `iwlist <WLAN-IF> scan` from rubbish to CSV
#!/bin/bash
# Copyright (C) 2016 Egon Kidmose
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#
# Converts output of `iwlist <WLAN-IF> scan` from rubbish to CSV
#
# Example:
#
@kidmose
kidmose / afs-installation.md
Last active November 13, 2017 11:41
AFS installation procedure

AFS installation instructions

Instructions for installing AFS, as used at Electronics Department, Aalborg University, under linux mint 18. This is based on my personal experienced and serves as documentation to me, but might be useful for other. Pull suggestions/PRs welcome.

Based on https://it-wiki.es.aau.dk/wiki/AFS_on_Debian/Ubuntu and adjusted to work based on my experience.

@kidmose
kidmose / install-latex-from-apt-get.sh
Last active November 6, 2019 09:48
List of all the aptitude packages that I commonly use when writing LaTeX, for easy installation on debian-like distros (Ubuntu, mint).
apt-get install -qy \
lmodern `# lmodern.sty` \
texlive-binaries \
texlive-base \
texlive-lang-european `# danish in babel` \
texlive-latex-base \
texlive-latex-recommended \
texlive-fonts-recommended `# for scalable fonts` \
texlive-fonts-extra `# dsfont.sty` \
texlive-science \