Skip to content

Instantly share code, notes, and snippets.

View jnsw's full-sized avatar

Jan Seewald jnsw

View GitHub Profile
@barbazul
barbazul / docker.crontab
Created May 12, 2021 17:50
Hacky docker clean up solution for my dev environment
# Cleanup Docker weekly
###
# First clear all volumes that are not associated with containers
# This way volumes can live up to 2 weeks without use.
#
15 8 * * 1 docker volume prune
###
# Then clear all images that have not been used in last week.
@selalipop
selalipop / GameState.cs
Last active September 9, 2022 20:29
Using Server-Sent-Events in Unity
using Newtonsoft.Json;
///Use of Newtonsoft.Json is fully optional
namespace Backend
{
[JsonObject]
public struct GameState
{
[JsonProperty("maxPlayers")] public int MaxPlayers;
[JsonProperty("imposterCount")] public int ImposterCount;
@TheJLifeX
TheJLifeX / 00-hand-gesture-recognition.gif
Last active April 18, 2024 21:53
Simple Hand Gesture Recognition Code - Hand tracking - Mediapipe
00-hand-gesture-recognition.gif
@IdrisCytron
IdrisCytron / ESP32BTMobileRobot.ino
Created October 7, 2019 09:07
Control your mobile robot using ESP32 through bluetooth connection.
/*
Project: ESP32 Bluetooth Mobile Robot
Board:
- ESP32 Dev Module (Node32 Lite)
https://my.cytron.io/p-node32-lite-wifi-and-bluetooth-development-kit
*/
#include <BluetoothSerial.h>
BluetoothSerial btSerial;
#define BT_NAME "ESP32BT-Idris" // Set bluetooth name
@eLement87
eLement87 / mqtt_tls_working.ino
Created December 10, 2017 13:12
ESP8266 Secure MQTT Connection with Client Certificate Authentication
#include <FS.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <PubSubClient.h>
#include <time.h>
// Insert your FQDN of your MQTT Broker
#define MQTT_SERVER "mqtt.srvx1.local"
const char* mqtt_server = MQTT_SERVER;
@petez69
petez69 / adam6050.py
Last active October 23, 2021 11:53 — forked from hdo/adam6050.py
Emulate Advantech ADAM-6050 for Synology Surveillance Station
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import time
import RPi.GPIO as GPIO
#import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
for x in range(2, 7):
GPIO.setup(x, GPIO.OUT)
@hdo
hdo / adam6050.py
Created December 7, 2016 10:35
Emulate Advantech ADAM-6050 for Synology Surveillance Station
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import time
class Echo(DatagramProtocol):
def datagramReceived(self, data, (host, port)):
print "received %r from %s:%d" % (data, host, port)
# Login
@macna
macna / PowerShell-Server-Reboot-Notification.ps1
Last active February 19, 2024 23:30
This PowerShell script sends an email notification when a server reboots. The script simply sends an email message, and is to be used on a scheduled task that is triggered at system startup.
# Get the server name
$hostName = hostname
# Define the email address to send notifications to
$toAddress = "someone@contoso.com"
# Send the notification
Send-MailMessage -To $toAddress -From "$hostName@contoso.com" -SmtpServer smtp.contoso.com -Subject "$hostName - Server Reboot" -Body "The server $hostName has rebooted."
@ondrejh
ondrejh / mountnfs.sh
Created January 29, 2014 10:43
Bash script: Wakeup and mount NFS server.
#!/bin/bash
#
# This script should do:
#
# 1) test if nfs folder is mounted and exit 0 if yes
# 2) try to mount it and exit 0 if success
# 3) try to wake the server if not possible to mount
# 4) wait while its not woked (pinging)
# 5) try againt 2-4 several times
@mpj
mpj / watcher.rb
Last active January 26, 2023 01:05
Keep directory in sync with remote server using Rsync and FSEvent.
#!/usr/bin/env ruby
require 'rubygems'
require 'rb-fsevent'
require 'ruby-growl'
def sync(local, host, remote, growl)
# Construct the bash command that runs rsync.