Skip to content

Instantly share code, notes, and snippets.

View krono's full-sized avatar

Tobias Pape krono

View GitHub Profile
#!/bin/sh
set -eux
# Sets path to brews + default (and NOT user configured)
sudo launchctl config user path "$(brew --prefix)/bin:$(sysctl -n user.cs_path)"
@krono
krono / mlnx_sriov.sh
Last active July 4, 2022 08:15 — forked from koallen/mlnx_sriov.sh
Script to enable SRIOV virtual functions on Mellanox cards
#!/bin/bash
set -eu
# Hat tip to https://gist.github.com/koallen/32709a244d77a2c0f8e17ed79a4092ed
MLNX_SRIOV_DEVICES=""
[ -e /etc/default/mlnx_sriov ] && . /etc/default/mlnx_sriov
# params
# - device sys path (e.g. /sys/class/infiniband/mlx5_0)
~45 Pages, some TeX shenanigans.
lualatex paper 153,96s user 8,90s system 98% cpu 2:45,71 total
xelatex paper 30,13s user 1,97s system 100% cpu 31,794 total
pdflatex paper 37,18s user 1,46s system 99% cpu 38,812 total
@krono
krono / targettestpinning.py
Created July 23, 2019 11:43
Test the pinning problem
from rpython.rtyper.lltypesystem import rffi
from rpython.translator.tool.cbuild import ExternalCompilationInfo
eci = ExternalCompilationInfo(
post_include_bits=["""
#ifndef __pinningtest_h
#define __pinningtest_h
#ifdef _WIN32
@krono
krono / xe-update-stats.sh
Created October 19, 2018 12:55
Update Xen info from an OpenBSD guest
#!/bin/sh
#
# add to /etc/rc.local
# [ -x /usr/local/bin/xe-update-stats ] && /usr/local/bin/xe-update-stats init
# add to `crontab -e`
# 1-59 * * * * /bin/sh /usr/local/bin/xe-update-stats
if [ "$1" = "init" ]; then
@krono
krono / xnf-to-host.sh
Last active October 19, 2018 12:14
Send ip addresses to Xen for info on OpenBSD
for ifline in $(dmesg | grep address | sed -E -e 's/^(xnf.+)\ at.*address\ ([a-fA-F0-9:]+)/\1=\2/' | sort); do
mac=$(echo $ifline | cut -d= -f2)
if=$(echo $ifline | cut -d= -f1)
for vif in $(hostctl device/vif); do
if [ "$mac" = "$(hostctl device/vif/$vif/mac)" ]; then
ip4=$(ifconfig $if | grep 'inet[^6]' | cut -d ' ' -f2)
ip6=$(ifconfig $if | grep 'inet6' | cut -d ' ' -f2 | cut -d% -f1)
if [ -n "$ip4" ]; then
hostctl attr/eth$vif/ip "$ip4"
fi
@krono
krono / Moep.st
Created September 18, 2018 11:49
'From Squeak5.2beta of 12 September 2018 [latest update: #18193] on 18 September 2018 at 1:48:53 pm'!
Model subclass: #Moep
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Moep'!
!Moep methodsFor: 'toolbuilder' stamp: 'topa 9/18/2018 13:48'!
buildContentsWith: builder
"-=-=-=-=-="
" This gets us Metacello "
"-=-=-=-=-="
Installer gemsource
project: 'metacello';
addPackage: 'ConfigurationOfMetacello';
install.
"Bootstrap Metacello Preview, using mcz files (#'previewBootstrap' symbolic version"
'From Squeak5.0 of 15 January 2016 [latest update: #15117] on 4 February 2016 at 1:52:02 pm'!
Object subclass: #RSqueak
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'RSqueak'!
!AutoStart class methodsFor: 'initialization' stamp: 'tfel 2/4/2016 13:09'!
startUp: resuming
"The image is either being newly started (resuming is true), or it's just been snapshotted.
@krono
krono / ban-ssh.sh
Last active November 21, 2016 22:55
Ban everyone who tries SSH (inspiration: http://huschi.net/14_360_de-portscan-honeypot-mit-iptables.html )
#!/bin/sh
PORT=22
TIMEOUT=600
for IPTABLE in iptables ip6tables; do
case "${IPTABLE}" in
iptables) LOCALHOST="127.0.0.1";;
ip6tables) LOCALHOST="::1";;
esac