Skip to content

Instantly share code, notes, and snippets.

View Stefan-Code's full-sized avatar

Stefan Kuntz Stefan-Code

View GitHub Profile
@Stefan-Code
Stefan-Code / lintian.txt
Created November 7, 2015 21:33
Syncthing deb lintian output
E: syncthing: unstripped-binary-or-object usr/bin/syncthing
W: syncthing: hardening-no-relro usr/bin/syncthing
E: syncthing: debian-changelog-file-missing
E: syncthing: file-in-etc-not-marked-as-conffile etc/ufw/applications.d/syncthing
W: syncthing: unknown-control-file changelog
W: syncthing: unknown-control-file compat
E: syncthing: no-copyright-file
E: syncthing: description-contains-tabs
W: syncthing: no-section-field
W: syncthing: no-priority-field
@Stefan-Code
Stefan-Code / imageAltText.js
Last active December 31, 2015 17:01
Image Alt text onclick (requires jQuery)
$('img').click(function() {$(this).after(function() {return "<p><code>"+$(this).attr('alt') + "</code></p>"})})
@Stefan-Code
Stefan-Code / ImgAltBookmarklet.js
Last active January 1, 2016 16:16
Image ALT Text bookmarklet (includes jQuery). Click on any image on page to show ALT text.
javascript:(function()%7Bfunction%20callback()%7B(function(%24)%7Bvar%20jQuery%3D%24%3B%24('img').click(function()%20%7B%24(this).after(function()%20%7Breturn%20%22%3Cp%3E%3Ccode%3E%22%2B%24(this).attr('alt')%20%2B%20%22%3C%2Fcode%3E%3C%2Fp%3E%22%7D)%7D)%7D)(jQuery.noConflict(true))%7Dvar%20s%3Ddocument.createElement(%22script%22)%3Bs.src%3D%22https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.7.1%2Fjquery.min.js%22%3Bif(s.addEventListener)%7Bs.addEventListener(%22load%22%2Ccallback%2Cfalse)%7Delse%20if(s.readyState)%7Bs.onreadystatechange%3Dcallback%7Ddocument.body.appendChild(s)%3B%7D)()
@Stefan-Code
Stefan-Code / python_send_email.py
Created January 5, 2016 17:34
Send an email using gmail in python
import smtplib
def send_email(user, pwd, recipient, subject, body):
"""
Sends an email using a gmail account.
"""
gmail_user = user
gmail_pwd = pwd
FROM = user
TO = recipient if type(recipient) is list else [recipient]
SUBJECT = subject
@Stefan-Code
Stefan-Code / SympySymbolicMath.py
Last active January 5, 2016 17:39
Sympy symbolic math boilerplate for iPython notebook
from sympy import *
from sympy.matrices import *
import seaborn as sns # seaborn for pretty graphs
import numpy as np # numpy for numerical stuff
init_session()
init_printing(use_latex='mathjax')
# now you're good to go.
#Example:
diff(2**x)
@Stefan-Code
Stefan-Code / bash.bashrc
Created January 7, 2016 14:25
/etc/bash.bashrc including colored git branch highlighting in command prompt
# System-wide .bashrc file for interactive bash(1) shells.
# To enable the settings / commands in this file for login shells as well,
# this file has to be sourced in /etc/profile.
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
@Stefan-Code
Stefan-Code / 10-quirks.conf
Created April 25, 2016 18:59
xorg config for lenovo x240
# Collection of quirks and blacklist/whitelists for specific devices.
# Accelerometer device, posts data through ABS_X/ABS_Y, making X unusable
# http://bugs.freedesktop.org/show_bug.cgi?id=22442
Section "InputClass"
Identifier "ThinkPad HDAPS accelerometer blacklist"
MatchProduct "ThinkPad HDAPS accelerometer data"
Option "Ignore" "on"
EndSection
@Stefan-Code
Stefan-Code / 50-synaptics.conf
Created April 25, 2016 18:59
xorg config for lenovo x240
Section "InputClass"
Identifier "Clickpad"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
# Synaptics options come here.
Option "Clickpad" "true"
option "EmulatedMidButtonTime" "0"
Option "SoftButtonAreas" "65% 0 0 40% 42% 65% 0 40%"
Option "AreaBottomEdge" "0%"
@Stefan-Code
Stefan-Code / disk-snapshot.md
Last active September 21, 2016 16:28
Hard Drive snapshot command

The following command creates a complete compressed disk snapshot of /dev/sda. Replace 500107862016 with the size of the media to be backed up so pv shows progress information. Runs at a speed of about 30MB/s for me. When using pigz instead of gzip for compression I can achieve speeds of around ~150MB/s (using SSDs).

dd if=/dev/sda conv=sync,noerror bs=64M | pv -s 500107862016 -pera | pigz -c &gt; /media/user/backup.gz

alert('XSS')