Skip to content

Instantly share code, notes, and snippets.

View Khoulaiz's full-sized avatar
🏠
Working from home

Andreas Sahlbach Khoulaiz

🏠
Working from home
View GitHub Profile
@Khoulaiz
Khoulaiz / check_dyn_hostname
Created August 30, 2013 13:46
check dyndns hostname and reload iptables to reavaluate dynamic hostnames from iptables config. put this in a cronjob and you can use dyndns entries in iptables configs.
#!/bin/bash
# check dyndns name of a host and reset iptables if change was detected
HOSTNAME=<hostname-to-check.dyndns.org>
LOGFILE=/var/run/check_home_ip
Current_IP=$(/usr/bin/dig +short $HOSTNAME)
if [ $LOGFILE = "" ] ; then
iptables-restore </etc/iptables_rules
var inputs = document.getElementsByTagName('input');
for (var i=0; i < inputs.length; i++) {
if (inputs[i].getAttribute('type').toLowerCase() === 'password') {
inputs[i].setAttribute('onpaste', '');
}
}
@Khoulaiz
Khoulaiz / gist:41b387883a208d6e914b
Last active May 3, 2024 15:57
Checking ports without telnet

Here are several different ways to test a TCP port without telnet.

$ cat < /dev/tcp/127.0.0.1/22
SSH-2.0-OpenSSH_5.3
^C

$ cat &lt; /dev/tcp/127.0.0.1/23
@Khoulaiz
Khoulaiz / gist:6be569b7626e0db9413d
Created January 28, 2016 18:08
CCcam.cfg entry for Vodafone KD
SMARTCARD CLOCK FREQUENCY: /dev/sci0 3570000
BOXKEY: /dev/sci0 12 34 56 78
TRY ALL CHIDS: /dev/sci0
SMARTCARD CLOCK FREQUENCY: /dev/sci1 3570000
BOXKEY: /dev/sci1 12 34 56 78
@Khoulaiz
Khoulaiz / nginx-lang.lua
Created January 30, 2016 08:58 — forked from colthreepv/nginx-lang.lua
Detect preferred language script for Nginx written in LUA
-------------------------------------------------------------------------------
-- HTTP Accept-Language header handler --
-- @originalAuthor: f.ghibellini@gmail.com --
-- @originalRepository: https://github.com/fghibellini/nginx-http-accept-lang--
-- @modifiedBy: marian.hello@mapilary.com --
-- @gist: https://gist.github.com/mauron85/47ed1075262d9e020fe2 --
-- @license: MIT --
-- @requires: --
-- @description: --
-- returns language with greatest quality --
@Khoulaiz
Khoulaiz / keybase.md
Created August 25, 2016 19:16
keybase.md

Keybase proof

I hereby claim:

  • I am Khoulaiz on github.
  • I am khoulaiz (https://keybase.io/khoulaiz) on keybase.
  • I have a public key whose fingerprint is A15C 4B1F F63B B0DA 9DC3 8C16 FBFF 0F87 219E 23C0

To claim this, I am signing this object:

@Khoulaiz
Khoulaiz / hs110.sh
Last active January 10, 2022 14:48
hs110.sh -- bash script to toggle wall plug from TP-LINK and check status
#!/bin/bash
##
# Switch the TP-LINK HS100 wlan smart plug on and off, query for status
# Tested with firmware 1.0.8
#
# Credits to Thomas Baust for the query/status/emeter commands
#
# Author George Georgovassilis, https://github.com/ggeorgovassilis/linuxscripts
#
@Khoulaiz
Khoulaiz / gist:2a186f75fce26b77a8dcaad63e59bf41
Created March 29, 2017 10:29
Show Gradle Input and Output Files of every Task during run
gradle.taskGraph.afterTask {task ->
StringBuffer taskDetails = new StringBuffer()
taskDetails << "-------------\nname:$task.name group:$task.group : $task.description\nconv:$task.convention.plugins\ninputs:"
task.inputs.files.each{ it ->
taskDetails << "${it.absolutePath}\n"
}
taskDetails << "outputs:\n"
task.outputs.files.each{ it ->
taskDetails << "${it.absolutePath}\n"
}
@Khoulaiz
Khoulaiz / .profile
Created May 16, 2017 20:54 — forked from tasmo/.profile
snipped for ediff with emacsclient for POSIX shells
### editor
export ALTERNATE_EDITOR=emacs
export EDITOR="emacsclient -tc -a emacs"
export VISUAL="emacsclient -c -a emacs"
# emacsclient as difftool
function ediff () {
if [ "X${2}" = "X" ]; then
echo "USAGE: ediff <FILE 1> <FILE 2>"
else
quoted1=${1//\\/\\\\}; quoted1=${quoted1//\"/\\\"}
@Khoulaiz
Khoulaiz / ec
Last active May 16, 2017 20:56 — forked from tasmo/ec
Start Emacs Client in GUI (and launch Emacs server if not already running)
#!/usr/bin/env bash
# Shamelessly taken from http://mjwall.com/blog/2013/10/04/how-i-use-emacs/
# This script starts emacs daemon if it is not running, opens whatever file
# you pass in and changes the focus to emacs. Without any arguments, it just
# opens the current buffer or *scratch* if nothing else is open. The following
# example will open ~/.bashrc
# ec ~/.bashrc