Skip to content

Instantly share code, notes, and snippets.

View dlgg's full-sized avatar

Damien Lesgourgues dlgg

View GitHub Profile
@dlgg
dlgg / git subtree.md
Created August 9, 2013 06:30
Git subtree for integration of an external repository inside a project

Sub-tree

This is only a memo for sub-tree integration of Dropbox SDK from is own repository.

Installation of sub tree (at the root of the project) :

    git remote add db_sdk_remote git@github.com:dlgg/DropboxTCL.git
    git fetch db_sdk_remote
    git checkout -b dropbox db_sdk_remote/master

git checkout master

#! /bin/sh
### BEGIN INIT INFO
# Provides: beep
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Beeps that indicate startup and shutdown
### END INIT INFO
@dlgg
dlgg / irssi-notif.sh
Last active December 24, 2015 05:39
Shell script for irssi notification via ssh with i3wm and twmn (https://github.com/sboli/twmn)
#!/bin/bash
# https://github.com/sboli/twmn
DEST=falkreath.ccrypto.org
PARAMS="--pos bottom_right -d 5000 --bg black --fg red --aot"
ssh -4 ${DEST} "tail -fn 0 .irssi/fnotify "|while read heading message; do
MSG=$(echo "% ${heading} % ${message} %"|sed -e 's/"//g' -e 's/ / /g')
twmnc -t IRC -c "${MSG}" ${PARAMS}
done &
@dlgg
dlgg / fonera.expect
Created November 24, 2013 23:48
Little expect script wich connect to fonera during Redboot, send ^C and go to interactive mode
#!/usr/bin/expect -f
#spawn cu -l /dev/ttyS0 -s 9600
spawn telnet 192.168.1.254 9000
set timeout 3600
# Look for prompt
expect "enter ^C to abort"
send \003
# send blank line (\r) to make sure we get back to gui
#expect "RedBoot>"
interact
#http://httpd.apache.org/docs/2.2/rewrite/intro.html#rewritecond
#http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond
#http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
#Use NOT logic. If cookie doesn't exist then redirect. Otherwise, default behavior.
RewriteCond %{HTTP_COOKIE} !request_method
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^/$ /public/ [NE,R,L]
@dlgg
dlgg / cacti-1min.sh
Created May 13, 2014 14:32
Cacti poll 5 minutes to 1 minute
for i in {1..70}; do php data_template_associate_rra.php --rra='1:2:3:4:5' --data-template-id=$i; done
mysql cacti -e "update data_template_data SET rrd_step = '60';"
#!/bin/sh
if [ $# -eq 0 ]; then
echo "Usage: $0 script args ..."
exit 1
fi
SCRIPT=$1
shift
env -i HOME="$HOME" PATH="$PATH" SHELL="$SHELL" "$SCRIPT" "$@"
@dlgg
dlgg / .bashrc_ssh
Last active August 29, 2015 14:15 — forked from mzedeler/.bashrc_ssh
#!/bin/bash
# Set up ssh-agent
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initializing new SSH agent..."
touch $SSH_ENV
chmod 600 "${SSH_ENV}"
/usr/bin/ssh-agent | sed 's/^echo/#echo/' >> "${SSH_ENV}"
@dlgg
dlgg / mkinventory.pl
Created October 16, 2015 17:28 — forked from jamesog/mkinventory.pl
Exporting from RackTables (e.g. for creating an inventory spreadsheet).
#!/usr/bin/env perl
use warnings;
use strict;
# Use modules installed with cpanm -L
use lib 'extlib/lib/perl5';
use DBI;
use POSIX qw(strftime);
use Spreadsheet::WriteExcel;
@dlgg
dlgg / gist:5b2b5f1ad5d0108bddaffddf2845387e
Created August 31, 2016 14:01 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents