Skip to content

Instantly share code, notes, and snippets.

Working from home

Hans syxolk

Working from home
  • TUM
  • Germany
Block or report user

Report or block syxolk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
syxolk /
Last active Apr 4, 2019
OR-Tools Indeterministic solution_hint bug
from ortools.sat.python import cp_model
class Slot:
def __init__(self,model):
self.model = model
self.start = model.NewIntVar(-1,COUNTS-1,name="")#inclusive
View sumConsecutiveOnes.js
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.counter = 0;
syxolk /
Created Dec 17, 2018
removeAll on keySet (with hashCode)
import java.nio.charset.StandardCharsets;
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) {
syxolk /
Last active Nov 17, 2018
Upgrade Postgresql 10 to 11 on Arch Linux

This guide is mainly based on Arch's wiki, with some additions:

  • I couldn't upgrade the database because the upgrade tool needs the file
  • The created cluster could not be used to upgrade from the old data because the locale was set to 'C' (needed to add --locale=en_US.UTF-8)
  • The upgrade tool checks if the the new postgresql installation has a compatible postgis version. That means we need postgis 2.4 for postgresql 11. Unfortunately, we cannot install it over the package manager, instead we need to compile it from source.
# Stop currently running server
systemctl stop postgresql.service

# Install new packages
syxolk /
Last active Oct 11, 2018
Install Linux on Lenovo V330-14IKB

Here's what I've done to install Ubuntu 18.04. on a Lenovo V330-14IKB laptop. The problem was that the live Ubuntu could not find the NVMe drive.

How get in the BIOS settings:

  • In Windows: Open the Recovery page in the system settings
  • Click "Restart Now"
  • Go to "Troubleshoot" and restart to UEFI settings screen

This guide is not comprehensive and/or correct but may help you to get started:

  1. Go to the BIOS -> Security -> Secure Boot -> Set to Disable
syxolk /
Created May 14, 2017
Check 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
syxolk /
Created Mar 21, 2017
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("")
return response.url[response.url.rfind("/")+2:]
def get_current():
output = subprocess.check_output(["atom", "--version"])
View miner.go
package main
import (
import requests
import json
import sys
def get_game_hours(profile_id):
r = requests.get("" + str(profile_id) + "/games/?tab=all")
hours = []
for line in r.text.splitlines():
if line.lstrip().startswith("var rgGames"):
ARGS="-c new_car --flags norender,sendData"
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
You can’t perform that action at this time.