Skip to content

Instantly share code, notes, and snippets.

on ^*:text:* has logged in.*:#yamaria: {
/echo -tm #terraria $1-
/haltdef
}
on ^*:text:* left the server.*:#yamaria: {
/echo -tm #terraria $1-
/haltdef
}
@Nama
Nama / lights.sh
Last active August 29, 2015 14:06
Sends TCP Pakets to the TCP Server. Turns on lights if Computer is reachable, off if not reachable. lights_state.sh syncs the states of the lights, so the lights are turned on on next day. Avoids turning off or on if you manually turned on or off the lights.Used with crontab.
#!/bin/bash
/usr/local/bin/ping -c 1 192.168.1.2
ec=$?
state=`cat /root/light2_state`
stat=`echo -e "licht 2 status" | nc 192.168.1.3 54321`
s=$((${#stat}-1))
stat=${stat:$s:1}
echo "nc: $stat"
echo "file: $state"
@Nama
Nama / shorturl.py
Created July 2, 2015 17:58
URL shortener, written in Python with flask
#!/usr/bin/env python
#########################################################################################
# #
'''A.T.S.P. Short-URL Controller''' #
# #
#########################################################################################
import cymysql
from flask import Flask, redirect
app = Flask(__name__)
@Nama
Nama / ssh-tunnel_update.sh
Created July 14, 2015 08:11
Use a proxy 5 server to update packages on a Linux machine
#!/bin/bash
REPOFILE="glusterfs-3.7.list"
SSHSERVER="ssh.server"
SSHUSER="username"
# Kopiere das Repo, damit es verwendet werden kann
cp $REPOFILE /etc/apt/sources.list.d/
if [[ $? -eq 0 ]]; then
# SSH-Tunnel über den user "tunnel" zum Login-Server, welcher im Hintergrund bleibt,
@Nama
Nama / homecontrol_client.py
Last active August 29, 2015 17:32
Control radio sockets and Senseo coffee machine with NetIO-App and do some other stuff. Github Repo: https://github.com/Nama/HomeControl
#!/usr/bin/python
import os
import sys
import socket
import time
from PIL import Image
from lglcd import LogitechLcd
from threading import Thread
@Nama
Nama / del.py
Last active December 27, 2015 00:59
Deleting of incoming and outdated SQL backups. Using with crontab.
#!/usr/bin/env python3
#Deleting of incoming and outdated SQL backups - Using with crontab
import os, re
d_list = sorted( #Filenames containing unix-timestamp, sorted() will set 'd_list' ordered, from old to new
re.findall(r'\w+\.sql\.gz', #searching for filenames
','.join(os.listdir('/home/kirika')))) #Listing all files in directory and putting them comma-seperated together
for i in range(len(d_list)-4): #Count of found files -4
os.remove(d_list[i]) #the newest 4 files wont be deleted
@Nama
Nama / ybot.py
Created January 5, 2014 11:48
IRC-Bot with broadcast and triggers. https://github.com/Nama/kirika
#! /usr/bin/env python
'''Yama's A.T.S.P.-Bot for IRC-Tasks'''
import irc.bot
import irc.strings
import re
import logging
import configparser
from time import sleep
from multiprocessing import Process
@Nama
Nama / color_ranks.py
Last active March 20, 2016 21:36
Custom user colors by user mode. Only effects the chat, not the userlist.
import hexchat
__module_name__ = 'color ranks'
__module_author__ = 'Yama'
__module_version__ = '0.1'
__module_description__ = 'Make user colors by rank'
def mod_colors(word, word_eol, userdata):
nickname = hexchat.strip(word[0], len(word[0]), 1)
nickname += '\003'
@Nama
Nama / kodi_youtube_link.py
Created May 7, 2016 13:34
Send various Youtube-Links to kodi over TCP. No need for the webinterface. TCP needs to be enabled. List and Channel links arent implemented yet.
@Nama
Nama / mnthdd.sh
Last active June 8, 2016 11:40
Easy mount devices encrypted with cryptsetup. I use this code in /etc/profile.d/
#!/bin/bash
mnthdd() {
# The full mount-path is put together bei $MOUNTPATH and $DRIVES
# In this example it would be /media/ + your parameter
MOUNTPATH="/media/"
# /etc/fstab
## hdd1
#/dev/mapper/hdd1 /media/hdd1 ext4 noauto,defaults 0 0
#