Skip to content

Instantly share code, notes, and snippets.

View PandaEox's full-sized avatar

Panda PandaEox

View GitHub Profile
#!/usr/bin/awk -f
# Convert the "svn log" output into a one liner format, which is easier to grep
# or use in scripts. Pipe "svn log" into this script
# When we get a line that starts with a revision number, put the data in variables
/^r[0-9]+/ {
rev=$1
user=$3
date=$5
@PandaEox
PandaEox / rpmbuild.bat
Created February 11, 2015 06:23
Building RPMs on Windows machines
SETLOCAL
PUSHD .
REM Update buildroot path
FOR /F "tokens=*" %%i in ('cygpath %3') do SET NEW_BUILDROOT=%%i
REM Update topdir path
SET TOPDIR=%5
SET TOPDIR=%TOPDIR:~9,-1%
FOR /F "tokens=*" %%i in ('cygpath "%TOPDIR%"') do SET NEW_TOPDIR=%%i
@PandaEox
PandaEox / dynamic.js
Created August 1, 2014 05:00
Dynamic jQuery loading
// Anonymous "self-invoking" function
(function() {
// Load the script
var script = document.createElement("SCRIPT");
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
script.type = 'text/javascript';
document.getElementsByTagName("head")[0].appendChild(script);
// Poll for jQuery to come into existance
var checkReady = function(callback) {
@PandaEox
PandaEox / loop.sh
Created June 18, 2014 10:42
Bash: Loop over regex
#!/bin/bash
# Thx to: http://mykospark.net/2014/01/iterating-through-regular-expression-matches-with-bash/
COMMENT=$1
REGEX_ISSUE_ID="([A-Z]+-[0-9]+|[0-9]{3,})"
while [[ ${COMMENT} =~ (${REGEX_ISSUE_ID}) ]]; do
echo "${BASH_REMATCH[1]}"
COMMENT=${COMMENT##*${BASH_REMATCH[1]}}
done
@PandaEox
PandaEox / rewrite.sh
Created June 3, 2014 11:12
Rewrite SVN User to git user
#!/bin/bash
raw=`cat users.txt`
IFS=$'\n'
arr=($raw)
output=""
for i in "${arr[@]}"
do
IFS='=' read -a line <<< "$i"
@PandaEox
PandaEox / tunnel.sh
Created June 3, 2014 09:14
SSH Tunnel
ssh user@PROXY -N -L LOC_PORT:TARGET:TARGET_PORT
ssh [email protected] -N -L 2222:10.0.2.1:22
@PandaEox
PandaEox / index.html
Last active August 29, 2015 14:01
FullHD ViewPort on Android
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;target-densityDpi:device-dpi;" />
@PandaEox
PandaEox / git_https.sh
Created May 14, 2014 09:54
Force git to use https
git config --global url."https://".insteadOf git://
@PandaEox
PandaEox / 000-default
Created May 12, 2014 04:43
Node through apache
FilterDeclare subst
FilterProvider subst SUBSTITUTE resp=Content-Type $text/
FilterProvider subst SUBSTITUTE resp=Content-Type $/xml
FilterProvider subst SUBSTITUTE resp=Content-Type $/json
FilterProvider subst SUBSTITUTE resp=Content-Type $/javascript
<location /node/>
ProxyPass http://localhost:1337/
ProxyPassReverse http://localhost:1337/
ProxyPassReverseCookiePath / /node/
@PandaEox
PandaEox / multi_ftp.sh
Created May 4, 2014 16:05
Download FTP with multiple connections
lftp -c 'pget -n 10 sftp://USER:PASSWORD@URL/PATH_TO/FILE.zip'