Skip to content

Instantly share code, notes, and snippets.

@tuxmartin
tuxmartin / udp_ipv6_client.py
Last active April 8, 2024 15:01
Python UDP IPv6 client & server
import socket
UDP_IP = "::1" # localhost
UDP_PORT = 5005
MESSAGE = "Hello, World!"
print "UDP target IP:", UDP_IP
print "UDP target port:", UDP_PORT
print "message:", MESSAGE
@tuxmartin
tuxmartin / irrecord list-namespace
Created December 21, 2015 10:30
OpenELEC - namapovani IR dalkoveho ovladani - LIRC
http://wiki.openelec.tv/index.php?title=Guide_To_lirc_rpi_GPIO_Receiver
https://learn.adafruit.com/using-an-ir-remote-with-a-raspberry-pi-media-center/using-other-remotes
http://openelec.tv/forum/103-infared-remotes/73288-mce-remote-recognises-one-button-only-on-cubox
---------------------------------------------------------------
# killall lircd
# irrecord --list-namespace
# modprobe lirc_rpi
# irrecord -d /dev/lirc0 /storage/.config/lircd.conf
@tuxmartin
tuxmartin / usleep.c
Last active December 24, 2015 23:40
// gcc -std=c99 -O3 -pedantic -Werror -static -o usleep usleep.c
// ./usleep 1000000
#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
@tuxmartin
tuxmartin / dns_zaznamy
Created December 26, 2015 19:08
Staticky zaznam DNS ve vlastni siti
# /etc/unbound/dns_zaznamy
local-zone: "lan." static
local-data: "server.lan. IN A 192.168.1.1"
local-data: "pc.lan. IN A 192.168.1.10"
local-data: "*.server.lan. IN CNAME server.lan."
local-data: "*.pc.lan. IN CNAME pc.lan."
@tuxmartin
tuxmartin / example.txt
Last active April 13, 2016 12:18
Raspberry Pi - expand partion and filesystem
root@martin:~# fdisk -l /dev/sdb
Disk /dev/sdb: 14.5 GiB, 15523119104 bytes, 30318592 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9ed9cab6
Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 133119 131072 64M c W95 FAT32 (LBA)
@tuxmartin
tuxmartin / 99-ubnt.conf
Last active January 16, 2016 16:17
Ubiquiti - log TxRate and RxRate to syslog
# /etc/rsyslog.d/99-ubnt.conf
:msg,contains,"UBNT_RXTX " /var/log/ubnt.log
vancl@vancl-pc:~/wrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2$ pwd
/home/vancl/wrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2
vancl@vancl-pc:~/wrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2$ ./toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-g++ -static-libstdc++ -o ubnt ubnt.cpp
vancl@vancl-pc:~/wrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2$ ./toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/mips-openwrt-linux-strip ubnt
vancl@vancl-pc:~/wrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2$ ls -lh | grep ubnt
-rwxrwxr-x 1 vancl vancl 448K led 19 20:12 ubnt
-rw-rw-r-- 1 vancl vancl 2,2K led 19 20:04 ubnt.cpp
vancl@vancl-pc:~/wrt/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2$ file ubnt
ubnt: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), dynamically linked (uses shared libs), stripped
vancl@vancl-pc:~/wrt/OpenWrt-Toolchain
@tuxmartin
tuxmartin / busybox_telnet_send_http_post.sh
Last active April 13, 2016 09:31
busybox_telnet_send_http_post
#!/bin/sh
host=10.123.1.1
port=80
ubnt_ifstats=`ubntbox ifstats.cgi`
# nesmi obsahovat binarni data!!!
(
echo open
@tuxmartin
tuxmartin / index.php
Last active January 30, 2016 16:19
WakeOnLan PHP
<?php
/*
# visudo
www-data ALL=NOPASSWD: /usr/sbin/etherwake
*/
$password = "test123";
if ( $_POST["computer"] ) {
if ( $_POST["password"] == $password ) {
@tuxmartin
tuxmartin / kamera.sh
Created January 27, 2016 17:07
Ziskani fotky pres RTSP video streamu a vlozeni fotky a obrazku.
#!/bin/bash
DATUM=`date +"%Y-%m-%d\\ %H\\:%M"`
NAHLED=`mktemp`
ffmpeg -i rtsp://:@192.168.123.10:8554/live0.264 -y -f image2 -sameq -t 0.0001 /var/www/XXX/obr.jpg
ffmpeg -i /var/www/XXX/obr.jpg -y -f image2 -sameq -t 0.0001 -vf \
"movie=/var/www/XXX/logo.png [logo]; [in][logo] overlay=10:10 [text], \
[text]drawtext=fontfile=/var/www/XXX/Ubuntu-B.ttf: text='$DATUM':fontcolor=white:fontsize=30:x=1030: y=685 [out]" /var/www/XXX/obr2.jpg