Skip to content

Instantly share code, notes, and snippets.

View ChristianGaertner's full-sized avatar

Christian Gärtner ChristianGaertner

View GitHub Profile
enum Gender {
MALE,
FEMALE,
UNKNOWN,
}
type Person = {
name: string;
age: number;
verified: boolean;
@ChristianGaertner
ChristianGaertner / fix.css
Last active June 12, 2018 11:44
Axure disable text selection
span {
-webkit-touch-callout: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
@ChristianGaertner
ChristianGaertner / scrobbling.js
Created November 25, 2017 12:02
last.fm currently playing track
const username = 'lastfm_username';
fetch(`https://cors-anywhere.herokuapp.com/https://www.last.fm/user/${username}`).then(r => r.text()).then(html => {
const parser = new DOMParser();
const doc = parser.parseFromString(html, "text/html");
const name = doc.querySelector('.now-scrobbling .chartlist-name > span > a').innerHTML;
const artist = doc.querySelector('.now-scrobbling .chartlist-name .chartlist-artists a').innerHTML;
return [name, artist];
}).then(console.log.bind(console));
(new-object System.Net.WebClient).DownloadFile('https://i.imgur.com/YgXoilr.jpg',"$Env:Temp\b.jpg");
Add-Type @"
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace Wallpaper
{
public enum Style : int
{
Tile, Center, Stretch, NoChange
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import random
def median(series):
return sum(series)/len(series)
class Beverage:
@ChristianGaertner
ChristianGaertner / main.py
Created January 8, 2016 15:43
Grouptable Generator of Square
# The elements (corners) of the squae
elements = ["a", "b", "c", "d"]
ops = {
'i': {"a": "a", "b": "b", "c": "c", "d": "d"}, #identity
'r': {"a": "b", "b": "c", "c": "d", "d": "a"}, # rot 90
's': {"a": "c", "b": "d", "c": "a", "d": "b"}, # rot 180
't': {"a": "d", "b": "a", "c": "b", "d": "c"}, # rot 270
'x': {"a": "d", "b": "c", "c": "b", "d": "a"}, # mirror x
@ChristianGaertner
ChristianGaertner / decompileGoals.py
Created October 28, 2015 01:35
Karel Goal Decompiling
import sys
def str_startswith(prefix):
def inner(i):
return i.strip().startswith(prefix)
return inner
gen_method_prefix = 'cg_m_'
byte_prefix = '\u'
@ChristianGaertner
ChristianGaertner / pr.md
Created July 27, 2015 19:16
achtern pull request template

One line to describe the pull request

Q A
Bug fix? yes/no
New feature? yes/no
BC breaks? yes/no
if BC breaks; where? %
Deprecations? yes/no
Tests pass? yes/no
#!/bin/bash
# PHP 5
export PATH=/usr/local/php5/bin:$PATH #PHP 5.5
alias mysql="/usr/local/mysql/bin/mysql"
#JAVA_HOME
export JAVA_HOME=$(/usr/libexec/java_home)
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser