Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Hans syxolk

  • 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
syxolk / minimal_example.py
Last active Apr 4, 2019
OR-Tools Indeterministic solution_hint bug
View minimal_example.py
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
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.output.push(acc.counter);
acc.counter = 0;
}
@syxolk
syxolk / RemoveAllTest.java
Created Dec 17, 2018
removeAll on keySet (with hashCode)
View RemoveAllTest.java
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) {
@syxolk
syxolk / upgrade-postgres.md
Last active Nov 17, 2018
Upgrade Postgresql 10 to 11 on Arch Linux
View upgrade-postgres.md

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

  • I couldn't upgrade the database because the upgrade tool needs the postgis-2.4.so 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
syxolk / install-linux.md
Last active Oct 11, 2018
Install Linux on Lenovo V330-14IKB
View install-linux.md

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
syxolk / mvgit.py
Created May 14, 2017
Check www.mvg.de for S-Bahn/U-Bahn/Bus departures and use Google TTS to speak it out loud.
View mvgit.py
#!/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
syxolk / atom-check-update.py
Created Mar 21, 2017
Compare the latest release with the currently installed version of Atom
View atom-check-update.py
#!/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"])
View miner.go
package main
import (
"archive/tar"
"bytes"
"compress/gzip"
"crypto/sha1"
"flag"
"fmt"
"io"
View steam-h-index.py
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"):
View lms-boot.sh
#!/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
You can’t perform that action at this time.