Skip to content

Instantly share code, notes, and snippets.

View geek-at's full-sized avatar
🐢

Christian Haschek geek-at

🐢
View GitHub Profile
@ah01
ah01 / cpu-tamp.sh
Created October 11, 2015 14:15
Send CPU temperature to MQTT
while true
do
t=$(cat /sys/class/thermal/thermal_zone0/temp)
t=$(($t/1000))
echo Teplota CPU $t
mosquitto_pub -h mqtt.sh.cvut.cz -t linuxdays/raspberry/temperature -m "$t °C"
sleep 5
done
@michaellihs
michaellihs / twisted.md
Last active August 27, 2024 17:07
Write your own ssh Server with the Python Twisted library

SSH Server with the Python Twisted Library

Installing the library

Assuming you have Python installed on your system:

pip install twisted
pip install pyOpenSSL
pip install service_identity
@thaJeztah
thaJeztah / docker-examples.md
Last active October 11, 2024 12:20
Some docker examples

Commit, clone a container

To 'clone' a container, you'll have to make an image of that container first, you can do so by "committing" the container. Docker will (by default) pause all processes running in the container during commit to preserve data-consistency.

For example;

docker commit --message="Snapshot of my container" my_container my_container_snapshot:yymmdd
@stetic
stetic / google-cloud-storage-upload-download.php
Last active September 25, 2023 19:20
PHP Example for Google Storage Upload and Download with Google APIs Client Library for PHP
<?php
/*
* PHP Example for Google Storage Up- and Download
* with Google APIs Client Library for PHP:
* https://github.com/google/google-api-php-client
*/
include( "Google/Client.php" );
include( "Google/Service/Storage.php" );
@mullnerz
mullnerz / archive-website.md
Last active May 14, 2025 14:38
Archiving a website with wget

The command I use to archive a single website

wget -mpck --html-extension --user-agent="" -e robots=off --wait 1 -P . www.foo.com

Explanation of the parameters used

  • -m (Mirror) Turns on mirror-friendly settings like infinite recursion depth, timestamps, etc.
@willurd
willurd / web-servers.md
Last active May 15, 2025 16:42
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@StuPig
StuPig / handlebar_partials.html
Created December 16, 2012 07:15
handlebars partials demo
<!DOCTYPE html>
<html>
<head>
<title>Handlebars Partials Example</title>
</head>
<body>
<h1>Handlebars Partials Example!</h1>
<div id="list">
</div>
@meglio
meglio / aes256cbc.php
Created October 27, 2012 17:12
Enc/Dec AES 256 CBC, with data consistency validation
private static function iv()
{
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_CBC);
return mcrypt_create_iv($iv_size, MCRYPT_RAND);
}
static function encrypt($str, $key32)
{
# Prepend 4-chars data hash to the data itself for validation after decryption
$str = substr(md5($str), 0, 4).$str;
@JeffPaine
JeffPaine / make_github_issue.py
Created July 19, 2012 17:24
Make an issue on github using API V3 and Python
import json
import requests
# Authentication for user filing issue (must have read/write access to
# repository to add issue to)
USERNAME = 'CHANGEME'
PASSWORD = 'CHANGEME'
# The repository to add this issue to
REPO_OWNER = 'CHANGEME'
@zekizeki
zekizeki / mqttpublish.php
Last active December 9, 2020 23:33
Simple pure MQTT publish client written in PHP
<?php
/**
*
* The MQTTClient class allows you to connect to an MQTT message broker and publish messages
* @author [email protected]
*
* Example use
* $client = new MQTTClient("robphptest","realtime.ngi.ibm.com",1883);
* $client->connect();