Skip to content

Instantly share code, notes, and snippets.

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

Felix Niederwanger grisu48

🏠
Working from home
View GitHub Profile
@grisu48
grisu48 / .travis.yml
Created May 14, 2019 15:55 — forked from ryboe/.travis.yml
Example .travis.yml for Golang
# use the latest ubuntu environment (18.04) available on travis
dist: xenial
language: go
# Force-enable Go modules. Also force go to use the code in vendor/
# These will both be unnecessary when Go 1.13 lands.
env:
- GO111MODULE=on
- GOFLAGS='-mod vendor'
@grisu48
grisu48 / read_nova_pm_sensor.py
Created April 10, 2019 09:20 — forked from marw/read_nova_pm_sensor.py
Get reading from Nova PM Sensor SDS011 (dust sensor, air quality sensor, PM10, PM2,5)
#!/usr/bin/env python3
"""
Get reading from Nova PM Sensor SDS011
(dust sensor, air quality sensor, PM10, PM2,5)
Designed to run from cron and append CSV file.
Script tested using Python3.4 on Ubuntu 14.04.
@grisu48
grisu48 / plot.py
Created April 8, 2019 10:15
Matplotlib CSV plotting utility
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
## 2019, Felix Niederwanger
## My matplotlib skeleton code for creating a plot based on CSV
## This python script reads in a CSV file with an arbitrary number of columns
## and creates a matplotlib plot out of it
## In the CSV file, the following parameters can be set:
##
## :title = STRING Set plot title
@grisu48
grisu48 / system_millis.c
Created June 27, 2018 14:14
Get system time in milliseconds
#include <sys/time.h>
long long system_ms() {
struct timeval te;
gettimeofday(&te, NULL); // get current time
long long milliseconds = te.tv_sec*1000LL + te.tv_usec/1000;
return milliseconds;
}
@grisu48
grisu48 / config.hpp
Last active June 27, 2018 11:17
Standalone config file reader
/*
* Configuration file reader
* 2018, Felix Niederwanger
*/
#include <string>
#include <fstream>
#include <map>
@grisu48
grisu48 / aes256.py
Created June 26, 2018 09:17
Python and AES256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Crypto.Cipher import AES
key = "00000000aaaaaaaa00000000aaaaaaaa"
iv = "0000000000000000"
message = "A really secret message. Not for prying eyes."
@grisu48
grisu48 / change_wallpaper.sh
Last active May 30, 2018 08:23
Change Wallpaper in Mate
#!/bin/bash
# This script changes my wallpepr to a random picture from my unsplash 'Landscape' collection in MATE
# 2018, phoenix, WTFPL Licence (http://www.wtfpl.net/)
COLLECTION="1356987" ## Or select your own collection id (must be public)
RESOLUTION="1366x768" ## Set to the resolution of your screen
cd /tmp
FILE="$HOME/Pictures/wallpaper.jpg"
#echo "Downloading picture ... "
@grisu48
grisu48 / Main.java
Created May 2, 2018 08:01
Java solution for the Cat-game at 34C3
package cat;
import java.io.Closeable;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
@grisu48
grisu48 / downloadGarmin.py
Last active May 2, 2018 07:16
Simple Python script to download current maps for my Garmin
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Python script for downloading the current GARMIN maps
import os
import requests
import random
import string
@grisu48
grisu48 / hostapd.conf
Created April 26, 2018 18:25
Default hostapd.conf
##### hostapd configuration file ##############################################
# Empty lines and lines starting with # are ignored
# AP netdevice name (without 'ap' postfix, i.e., wlan0 uses wlan0ap for
# management frames with the Host AP driver); wlan0 with many nl80211 drivers
# Note: This attribute can be overridden by the values supplied with the '-i'
# command line parameter.
interface=wlan0
# In case of atheros and nl80211 driver interfaces, an additional