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 / makecert.sh
Created May 4, 2021 06:52 — forked from jim3ma/makecert.sh
Golang TLS server and client
#!/bin/bash
# call this script with an email address (valid or not).
# like:
# ./makecert.sh joe@random.com
mkdir certs
rm certs/*
echo "make server cert"
openssl req -new -nodes -x509 -out certs/server.pem -keyout certs/server.key -days 3650 -subj "/C=DE/ST=NRW/L=Earth/O=Random Company/OU=IT/CN=www.random.com/emailAddress=$1"
echo "make client cert"
openssl req -new -nodes -x509 -out certs/client.pem -keyout certs/client.key -days 3650 -subj "/C=DE/ST=NRW/L=Earth/O=Random Company/OU=IT/CN=www.random.com/emailAddress=$1"
@grisu48
grisu48 / sockaddr_tostr
Created November 5, 2019 11:02 — forked from jkomyno/sockaddr_tostr.h
Convert a struct sockaddr address to a string, IPv4 and IPv6
// Convert a struct sockaddr address to a string, IPv4 and IPv6:
char *get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen)
{
switch(sa->sa_family) {
case AF_INET:
inet_ntop(AF_INET, &(((struct sockaddr_in *)sa)->sin_addr),
s, maxlen);
break;
@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 / tmux-cheatsheet.markdown
Created April 23, 2018 08:16 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@grisu48
grisu48 / AES.c
Created April 27, 2017 11:08 — forked from bricef/AES.c
A simple example of using AES encryption in Java and C.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* MCrypt API available online:
* http://linux.die.net/man/3/mcrypt
*/
#include <mcrypt.h>
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|