Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
deploying awesomeness

Jaka Hudoklin offlinehacker

🤓
deploying awesomeness
View GitHub Profile
View wordpress_create.sh
#!/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 Aug 9, 2011
Persistent ssh tunnel.
View ssh_tunnel.sh
#!/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"
View app.sh
#!/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 Sep 1, 2012
Jenkins script console shell client
View jenkins_admin.py
#!/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 Sep 14, 2012
Disk seek time measure
View seeker.c
#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>
View README.md

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 Nov 11, 2012
Python poll based multiprocessing example that works
View multiprocessing.py
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 Aug 22, 2019
Script that learns openvpn hostnames from cert CN filed
View README.rst

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?

View kalman.py
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']
View ffmpeg-opengl-notes
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