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 / 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)
@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
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"):
package main
import (
"archive/tar"
"bytes"
"compress/gzip"
"crypto/sha1"
"flag"
"fmt"
"io"
@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
@syxolk
syxolk / install-linux.md
Last active October 16, 2022 19:56
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
syxolk / upgrade-postgres.md
Last active July 18, 2022 11:32
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 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 / 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) {