Skip to content

Instantly share code, notes, and snippets.

View TobleMiner's full-sized avatar
🔥

Toble_Miner/tsys TobleMiner

🔥
  • Kiel
View GitHub Profile
@TobleMiner
TobleMiner / vfio-bind
Created April 10, 2016 14:41
VFIO binding service
#!/bin/sh
modprobe vfio-pci
for dev in "$@"; do
echo Handling device "$dev"
devpath="/sys/bus/pci/devices/$dev"
if ! [ -d $devpath ]; then
echo "$devpath doesn't exist"
exit 1
fi
if [ -L $devpath/driver/module ]; then
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: fastd
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Should-Start: network-manager
# Should-Stop: network-manager
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@TobleMiner
TobleMiner / MorseCoder.java
Created January 21, 2016 08:54
MorseCoder with "DEBUG" output
package programming.set9.morses;
import java.nio.charset.Charset;
public class MorseCoder
{
private static boolean DEBUG = false;
/**
* Simple static test of the morse encode/decode functions
@TobleMiner
TobleMiner / RectangleDIstanceCalculator.java
Created January 20, 2016 13:34
Chris RectangleDistanceCalculator
package test.chris;
import java.awt.geom.Rectangle2D;
public class RectangleDistanceCalculator
{
// PRIVATE METHODS
// TESTMETHODE
@TobleMiner
TobleMiner / uppercase_to_lowercase.s
Last active January 14, 2016 17:55
DLX asm ASCII upper case to lower case
// Registers
// R1: Length of text and decrementing counter (Assignment doesn't indicate that it must be preseved)
// R2: Temp register
// R3: Magic value used to add 32 to all bytes in a word
// Memory
// 1000..1000 + r1 : ASCII input
// 2000..2000 + r1 : ASCII output
START:
@TobleMiner
TobleMiner / nein.java
Created January 13, 2016 19:16
ARGB to RGB blend
public static int convertARGBtoRGB(int argbValue)
{
int rgb = 0;
// Extract bit 24 - 31 and discard sign (& 0xFF)
double alpha = ((argbValue >> 24) & 0xFF) / 255d;
for(int i = 0; i <= 16; i += 8)
{
// Extract color channel
int channel = argbValue >> i & 0xFF;
@TobleMiner
TobleMiner / Schrödingers icvpn
Created November 23, 2015 23:00
Schrödingers icvpn
tobias@Twily:~$ sudo ping6 fda1:384a:74de:4242:16cc:20ff:fe5e:7462
PING fda1:384a:74de:4242:16cc:20ff:fe5e:7462(fda1:384a:74de:4242:16cc:20ff:fe5e:7462) 56 data bytes
64 bytes from fda1:384a:74de:4242:16cc:20ff:fe5e:7462: icmp_seq=6912 ttl=60 time=81.9 ms
64 bytes from fda1:384a:74de:4242:16cc:20ff:fe5e:7462: icmp_seq=20906 ttl=60 time=96.2 ms
64 bytes from fda1:384a:74de:4242:16cc:20ff:fe5e:7462: icmp_seq=21991 ttl=60 time=88.8 ms
64 bytes from fda1:384a:74de:4242:16cc:20ff:fe5e:7462: icmp_seq=34494 ttl=60 time=95.3 ms
^C
--- fda1:384a:74de:4242:16cc:20ff:fe5e:7462 ping statistics ---
39486 packets transmitted, 4 received, 99% packet loss, time 39498138ms
rtt min/avg/max/mdev = 81.948/90.589/96.224/5.743 ms
local window = tui.Window.create(uiManager)
window:setSize(39, 26)
local label = tui.Label.create(uiManager)
label:setPos(2, 3)
label:setText("Hello World")
label:setOnclick(function() print("Click") end)
window:addChild(label)
local layout = tui.ReactorLayout.create(uiManager)
layout:setPos(4, 5)
window:addChild(layout)
@TobleMiner
TobleMiner / gist:65625a31e2ccd1909620
Created March 4, 2015 17:27
Apache mod_rewrite HTTP -> HTTPS redirect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</IfModule>
@TobleMiner
TobleMiner / gist:d0b7049db531e631e4fd
Last active August 29, 2015 14:16
Apache SSLEngine config TLS only, !RC4, HSTS
SSLEngine On
SSLProtocol all -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH EDH+aRSA !RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS"
SSLCertificateFile /etc/ssl/certs/certificate.crt
SSLCertificateKeyFile /etc/ssl/private/privatekey.key
SSLCertificateChainFile /etc/ssl/ca/itermediate-cert.pem
SSLCACertificateFile /etc/ssl/ca/ca.pem