Skip to content

Instantly share code, notes, and snippets.

View offlinehacker's full-sized avatar
🤓
deploying awesomeness

Jaka Hudoklin offlinehacker

🤓
deploying awesomeness
View GitHub Profile
@offlinehacker
offlinehacker / wordpress_create.sh
Created August 9, 2011 21:51
Wordpress create
#!/bin/sh
WORDPRESS_ROOT=/usr/share/
WORDPRESS_NAME=$1
PASSWORD=$2
DOMAIN=$3
if [ $# -ne 3 ]
then
echo "Syntax: `basename $0` wordpress_name password domain"
exit
@offlinehacker
offlinehacker / ssh_tunnel.sh
Created August 9, 2011 22:01
Persistent ssh tunnel.
#!/bin/sh
if [ $# -ne 1 ]
then
echo "Syntax: `basename $0` username@domain.name"
exit
fi
IP=$1
cmd="ssh $IP -f -n /bin/ping -i 20 localhost"
@offlinehacker
offlinehacker / app.sh
Created September 4, 2011 14:27
Start web app
#!/bin/bash
##################################################
# Get application's window ID
# Input:
# $1: application's process ID
# Output:
# $1: application's window ID
# Return value:
# success: 0
# failed: 1
@offlinehacker
offlinehacker / jenkins_admin.py
Created September 1, 2012 22:02
Jenkins script console shell client
#!/usr/bin/python
import re
import sys
import urllib
import urllib2
command=" ".join(sys.argv[1:])
srv="http://IP:8082/script"
script="def command = \"\"\""+command+"\"\"\"\ndef proc = command.execute()\nproc.waitFor()\nprintln \"stdout: ${proc.in.text}\""
data= urllib.urlencode({'script': script, 'json':'{"script": "' + script + '", "": "'+script+'"}', 'Submit': 'Run'})
@offlinehacker
offlinehacker / seeker.c
Created September 14, 2012 21:30
Disk seek time measure
#define _LARGEFILE64_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <signal.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
@offlinehacker
offlinehacker / README.md
Created October 19, 2012 08:21
Tasker nexmo

Android tasker nexmo sms sender

Allows you to send sms-es with custom source number from android using Tasker application and this script.

Requirements:

@offlinehacker
offlinehacker / multiprocessing.py
Created November 11, 2012 17:30
Python poll based multiprocessing example that works
import random
from multiprocessing import Pool,TimeoutError
from time import sleep
servers=["s1","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","s12","s13","s14","s15","s16","s17","s18","s19","s20","s21","s22","s23","s24","s25","s26","s27","s28","s29","s30"]
blah = "no callback"
def f(x):
print("start f(" + x + ")")
@offlinehacker
offlinehacker / README.rst
Last active January 8, 2022 18:21
Script that learns openvpn hostnames from cert CN filed

ovpn-learnaddress

openvpn learn-address script to manage a hosts-like file

  • intended to allow dnsmasq to resolve openvpn clients
  • written for openwrt (busybox), but should work most anywhere

How it works?

import os
import sys
import Image, ImageSequence
import numpy as np
from images2gif import writeGif
filename = sys.argv[1]
im = Image.open(filename)
original_duration = im.info['duration']
LD_LIBRARY_PATH=../lib64/ ./glc-capture --start -v 3 --disable-audio --uncompressed=1M -z none -o /dev/stdout -l /dev/stderr etracer | LD_LIBRARY_PATH=../lib64/ ./glc-play /dev/stdin -t -v 3 -y 1 --uncompressed=1M -o /dev/stdout | ffmpeg -i /dev/stdin -f yuv4mpegpipe -pix_fmt yuv420p -vcodec libx264 -vprofile baseline -preset ultrafast -tune zerolatency -x264opts "intra-refresh:vbv-maxrate=5000:vbv-bufsize=200:slice-max-size=1500:sliced-threads" -threads auto -f yuv4mpegpipe -o /dev/stdout | ../../scripts/video/example
gcc -g -std=gnu99 -Wall -I/usr/include -L/usr/lib -L/usr/lib/x86_64-linux-gnu/ test.c aveasy.c -lglut -lGL -lGLU -lGLEW -lglfw `pkg-config --cflags --libs libavcodec libavformat libavdevice libswscale` -o example