Skip to content

Instantly share code, notes, and snippets.

View Gummibeer's full-sized avatar
🐼
beary busy

Tom Herrmann Gummibeer

🐼
beary busy
View GitHub Profile
function waitForElement(selector) {
return new Promise(function(resolve, reject) {
var runs = 1;
var interval = setInterval(function() {
if (runs >= 30) {
clearInterval(interval);
reject(new Error('max runs exceeded'));
}
var el = document.querySelector(selector);
@Gummibeer
Gummibeer / git_delete_untracked_branches.sh
Last active June 19, 2020 15:05
git_delete_untracked_branches.sh
# EN
git checkout master && git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
# DE
git checkout master && git fetch -p && git branch -vv | awk '/: entfernt]/{print $1}' | xargs git branch -D
@Gummibeer
Gummibeer / ecosia_bot.js
Last active December 4, 2017 13:11
This script plants trees by botting Ecosia search
Array.prototype.random = function() {
return this[Math.floor(Math.random() * this.length)];
};
var properties = [
'car',
'house',
'phone',
'money'
];
@Gummibeer
Gummibeer / setup.sh
Created September 7, 2017 10:25
install new ubuntu
sudo add-apt-repository ppa:numix/ppa
sudo add-apt-repository ppa:papirus/papirus
sudo apt update && sudo apt install papirus-icon-theme numix-gtk-theme numix-icon-theme-circle unity-tweak-tool
sudo mkdir /etc/lightdm/lightdm.conf.d
sudo sh -c 'printf "[SeatDefaults]\nallow-guest=false\n" > /etc/lightdm/lightdm.conf.d/50-no-guest.conf'
sudo apt-get install git php7.0-cgi php7.0-cli php7.0-mcrypt php7.0-mbstring php7.0-xml php7.0-zip php7.0-json
@Gummibeer
Gummibeer / steam.sh
Created August 16, 2017 11:00
steam.sh
LD_PRELOAD='/usr/$LIB/libstdc++.so.6' steam
sudo apt-get install php7.1-zip php7.1-xml php7.1-imagick php7.1-gd php7.1-curl php7.1-mcrypt php7.1-mysql php7.1-geoip php7.1-sqlite3 php7.1-mbstring
@Gummibeer
Gummibeer / single_committer.sh
Last active May 30, 2017 14:53
Send a single commit for every changed file
git status --porcelain | while read -r a; do if [[ $a == M* ]] ; then FILE=`echo "$a" | awk '{print $2}'`; git commit -m "[ISSUE] $FILE" $FILE; fi done
_isSafePos = false;
_minDist = 250;
_building = objNull;
_itterations = 0;
_maxItterations = 5;
while {!_isSafePos && _itterations < _maxItterations} do {
_players = allPlayers - entities "HeadlessClient_F";
_alivePlayers = [];
_playerPositions = [];
@Gummibeer
Gummibeer / sort_colors.py
Last active February 7, 2017 10:46
Sort colors by HUE
import colorsys
def get_hsv(value):
if(not isinstance(value, str)):
value = value[1]
value = value.lstrip("#")
lv = len(value)
r, g, b = tuple(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))
return colorsys.rgb_to_hsv(r, g, b)