Skip to content

Instantly share code, notes, and snippets.

View gnanet's full-sized avatar

Gergely Nagy gnanet

  • Self-Employed Freelancer
  • Hungary
  • X @gnanet
View GitHub Profile
#!/bin/bash
#
# Author: Andrea Lazzarotto
# http://andrealazzarotto.com
# [email protected]
# Slideshare Downloader
# This script takes a slideshare presentation URL as an argument and
# carves all the slides in flash format, then they are converted to
# and finally merged as a PDF
@gnanet
gnanet / ipwebcam-view-and-record
Last active October 30, 2017 15:02
View and record ogg video(no audio) from an Android phone on linux over WIFI
PREFACE:
I was playing around with the IP Webcam app, and was looking for a fast and simple solution for getting the stream recorded while i can monitor what is being recorded, but a year ago i could not find a good solution. After the last update of the Android app, i thought i check again, and the best hint came from the suggested "Videochat driver" solution for linux: https://github.com/bluezio/ipwebcam-gst
and the linked blog of the author Dr. Antonio García-Domínguez: http://xmleye.wordpress.com/2011/07/08/reutilizar-un-movil-android-como-webcam-con-droidcamx-e-ip-webcam/
After a half day reading the docs and mailinglists the resulting commandline is below.
GOAL: Simultaneously monitor and record a video stream using the IP Webcam Android app and a Linux desktop
@gnanet
gnanet / Snippet-flashplayer-pause.sh
Last active August 29, 2015 14:05
Pause and Continue adobe flash game in linux
#Pause
#pgrep -f libflashplayer.so | xargs -n1 kill -STOP
#Continue
#pgrep -f libflashplayer.so | xargs -n1 kill -CONT
@gnanet
gnanet / hetzner-multi-ip-same-subnet
Created January 30, 2015 17:47
Snippet for Hetzner Root server with multiple IP address in the same subnet
iface eth0 inet static
address $ETH0
netmask 255.255.255.224
# network $NW
broadcast $BC
post-up ip route add $GW/32 dev eth0 src $ETH0 table mainip
post-up ip route add default via $GW dev eth0 table mainip
post-up ip rule add from $ETH0 table mainip
# post-up ip route add default scope global nexthop via $GW dev eth0
post-down ip rule del from $ETH0 table mainip
@gnanet
gnanet / owncloud-6-phpseclib-net-sftp.diff
Created February 6, 2015 21:19
Represent real remote filesize over 4GB in owncloud 6
--- SFTP.php 2015-02-06 22:12:50.489904403 +0100
+++ SFTP.php 2015-02-06 22:14:35.188130523 +0100
@@ -1773,12 +1773,16 @@
// of course, you shouldn't be using Net_SFTP to transfer files that are in excess of 4GB
// (0xFFFFFFFF bytes), anyway. as such, we'll just represent all file sizes that are bigger than
// 4GB as being 4GB.
+// extract(unpack('Nupper/Nsize', $this->_string_shift($response, 8)));
+// if ($upper) {
+// $attr['size'] = 0xFFFFFFFF;
+// } else {
@gnanet
gnanet / mirrormeta2sed
Created February 13, 2015 22:24
rdiff-backup mirror_metadata object removal sed calculator
#!/bin/bash
if [ $1 ]
then
object=$1
objectbase=`basename $1`
else
echo "$0 object"
echo " only full path of object in metadata works, object may be dir or file"
echo " dir object is recursive"
echo " example:"
@gnanet
gnanet / from_real_seven.cf
Created June 11, 2015 21:46
Spamassassin rule to filter "From" header for addresses where email user part consists of (realname)(7 random letters)(realname)@
header FROM_REAL_SEVEN From =~ /"(\S*).*" <\1([a-z0-9]{7})[a-z]*\@/i
describe FROM_REAL_SEVEN From contains Realname 7 random letters in the middle
score FROM_REAL_SEVEN 5
@gnanet
gnanet / varnish-configtest.sh
Created September 13, 2015 21:05
Varnish configtest, with preliminary test for the presence of includes
#!/bin/bash
missing=0
while read inc
do
if [ ! -f "${inc}" ]
then
echo "Missing: ${inc}"
missing=$((missing+1))
fi
@gnanet
gnanet / varnish-abandoned-vcl.so-check.sh
Last active September 13, 2015 22:19
Check for abandoned vcl.XXXXXXX.so and _.vsm files
#!/bin/bash
varnish_user=`ps aux | grep varnishd | grep root | grep -o "\-u .* \-g" | awk {' print $2 '}`
varnish_effective_pid=`ps aux | grep varnishd | grep "^${varnish_user}" | awk {' print $2 '}`
varnish_lib=`lsof -p ${varnish_effective_pid} | grep cwd | awk {' print $9 '}`
if [ ! -d "${varnish_lib}" ]; then echo "Missing ${varnish_lib} - maybe located elsewhere?!"; exit 1; fi
while read line
do
fstest=`lsof -p ${varnish_effective_pid} | grep ${varnish_lib} | grep REG | awk {' print $9 '} | sed -e "s#${varnish_lib}/##g" | grep $line`
@gnanet
gnanet / update-deb-new-upstream-notes.txt
Created September 18, 2015 21:25
NOTES: Updating a Debian package with a new upstream release generalized
Based on http://blog.fili.nl/updating-a-debian-package-with-a-new-upstream-release/
wget {URL OF NEW UPSTREAM SOURCE TAR.GZ}
sudo apt-get install devscripts
sudo apt-get build-dep {PACKAGENAME}
sudo apt-get source {PACKAGENAME}
cd {PACKAGESOURCE-DIR}
uupdate ../{NEW UPSTREAM SOURCE TAR.GZ} -v {NEW UPSTREAM VERSION}