Skip to content

Instantly share code, notes, and snippets.

View syxolk's full-sized avatar
🏠
Working from home

Hans syxolk

🏠
Working from home
  • Germany
View GitHub Profile
@syxolk
syxolk / better-favicon.user.js
Created September 4, 2015 20:17
Replaces Google's current favicon with an older one.
// ==UserScript==
// @name BetterFavicon
// @namespace YoloSwaghettiGroup
// @description A better favicon for google
// @include https://*.google.com/*
// @include http://*.google.com/*
// @include https://*.google.de/*
// @include http://*.google.de/*
// @grant none
// @author Deine Mudda
#!/bin/bash
ENABLE=1
CONFIG_REPO=phibedy.config_auto_drive.d6c3c3
ARGS="-c new_car --flags norender,sendData"
USER=odroid
if [ $ENABLE -eq 1 ]; then
daemon --name=lms --user=$USER --attempts=1 --delay=5 --output=/tmp/lms.log --respawn -- /home/$USER/$CONFIG_REPO/run $ARGS
fi
@syxolk
syxolk / urlextender.py
Last active February 14, 2016 23:47
Revert the process of url shortening: Traverse and show redirects of a URL.
#!/usr/bin/env python3
import sys, requests
USER_AGENT = 'Mozilla/5.0 (Windows NT 6.3; rv:44.0) Gecko/20100101 Firefox/44.0'
if __name__ == '__main__':
if len(sys.argv) != 2:
print('Usage: urlextender.py <url>')
sys.exit(1)
import requests
import json
import sys
def get_game_hours(profile_id):
r = requests.get("https://steamcommunity.com/profiles/" + str(profile_id) + "/games/?tab=all")
hours = []
for line in r.text.splitlines():
if line.lstrip().startswith("var rgGames"):
@syxolk
syxolk / atom-check-update.py
Created March 21, 2017 10:23
Compare the latest release with the currently installed version of Atom
#!/usr/bin/env python3
import requests
import subprocess
def get_latest():
response = requests.get("https://github.com/atom/atom/releases/latest")
return response.url[response.url.rfind("/")+2:]
def get_current():
output = subprocess.check_output(["atom", "--version"])
@syxolk
syxolk / mvgit.py
Created May 14, 2017 15:11
Check www.mvg.de for S-Bahn/U-Bahn/Bus departures and use Google TTS to speak it out loud.
#!/usr/bin/env python3
import requests
import datetime
import argparse
from gtts import gTTS
import math
import subprocess
import hashlib
import os.path
import tempfile
package main
import (
"archive/tar"
"bytes"
"compress/gzip"
"crypto/sha1"
"flag"
"fmt"
"io"
@syxolk
syxolk / RemoveAllTest.java
Created December 17, 2018 09:56
removeAll on keySet (with hashCode)
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class RemoveAllTest {
public static void main(String[] args) {
const arr = [1,1,0,0,1,1,1,0,1];
function sumConsecutiveOnes(arr) {
return [...arr, 0].reduce((acc, value) => {
if(value === 1) {
acc.counter += 1;
} else if(acc.counter > 0) {
acc.output.push(acc.counter);
acc.counter = 0;
}
@syxolk
syxolk / minimal_example.py
Last active April 4, 2019 18:29
OR-Tools Indeterministic solution_hint bug
from ortools.sat.python import cp_model
COUNTS = 10
MIN_VAL = 2
MAX_VAL = 4
class Slot:
def __init__(self,model):
self.model = model
self.start = model.NewIntVar(-1,COUNTS-1,name="")#inclusive