Skip to content

Instantly share code, notes, and snippets.

View MartinBrugnara's full-sized avatar

Martin Brugnara MartinBrugnara

View GitHub Profile
@MartinBrugnara
MartinBrugnara / search.js
Created May 7, 2013 09:14
jQuery Filter - Search Table - with typeahead
var SEARCH_MODE = 1;
$("#search-input").keyup(function(){
if($(this).val() != ""){
// hide all rows
$("#search-table :not(thead, tfoot) tr").hide();
if(SEARCH_MODE==0){
// Mode 0: Require at least one word per row
var search_string = $.map($(this).val().split(/[^a-zA-Z0-9]/), function(e, i){
return "#search-table td:contains-ci('"+e+"')";
@MartinBrugnara
MartinBrugnara / btsync.supervisor.conf
Last active September 22, 2016 01:45
Supervisor .conf for Bit Torrent Sync (btsync)
[program:btsync]
command=/usr/local/btsync/btsync --nodaemon --config /usr/local/btsync/sync.conf
user=<%= btuser %>
redirect_stderr=true
stdout_logfile=/tmp/btsync.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=3
@MartinBrugnara
MartinBrugnara / ubuntu NetworkManager DNS fix
Created August 16, 2013 16:24
ubuntu NetworkManager DNS fix
If you, like me, does'not accept anymore that NetworkManager change/lose you DNS configuration...
And if you doesn't know what this line is for...
This trick should fix your problem!
file:
/etc/NetworkManager/NetworkManager.conf
line 3:
dns=dnsmasq
@MartinBrugnara
MartinBrugnara / Remove File via symlink
Last active December 24, 2015 04:19
Remove file from symlinks (soft links)
@MartinBrugnara
MartinBrugnara / backlight
Created March 13, 2014 17:04
intel backlight - brightness management tool
max=`cat /sys/class/backlight/intel_backlight/max_brightness`
req=$1
if [ $req -le 5 ]; then
req=5
fi
if [ $req -ge 100 ]; then
req=100
fi
next=$[$max * $req / 100]
@MartinBrugnara
MartinBrugnara / syncthing.conf
Created May 13, 2014 11:48
upstart syncthing
description "Syncthing deamon"
start on (starting ufw)
stop on [!023456]
env STNORESTART=yes
env HOME=/srv/sync
respawn
@MartinBrugnara
MartinBrugnara / extract_magnet.sh
Created March 28, 2016 16:19
tntvillage query result page to list of magnet links
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage $0 tntpage.htm"
exit 1
fi
cat "$1" | grep 'showtopic' | sed -e "s/.*href=['\"]\([^\"']*?showtopic=[^\"']*\)['\"].*/\1/" \
| grep '^http' | grep index | xargs -n 1 curl \
| grep 'magnet:?' | sed -e "s/.*href=['\"]\(magnet:?[^\"']*\)['\"].*/\1/"

Keybase proof

I hereby claim:

  • I am MartinBrugnara on github.
  • I am martinbrugnara (https://keybase.io/martinbrugnara) on keybase.
  • I have a public key whose fingerprint is AD35 1834 ABDA BFF7 4C13 C034 3093 1A1F F36D D5E9

To claim this, I am signing this object:

@MartinBrugnara
MartinBrugnara / fixing_matrix.rb
Created April 23, 2018 07:23
fixing_matrix.rb
#!/usr/bin/env ruby
# matrix.rb
# MB version (heavily broken)
# class MatrixArgumentError < ArgumentError; end
# class MatrixRuntimeError < RuntimeError; end
class Matrix
@MartinBrugnara
MartinBrugnara / 85-yubikey.rules
Last active November 14, 2024 14:18
Xscreensaver autolock on yubikey remove
# /etc/udev/rules.d/85-yubikey.rules
# https://stackoverflow.com/questions/13699241/passing-arguments-to-shell-script-from-udev-rules-file#14982520
# https://askubuntu.com/questions/635266/use-of-yubikey-neo-for-login-2fa-and-lock-screen#635267
# Bus 001 Device 012: ID 1050:0407 Yubico.com
ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", RUN+="/usr/local/bin/yubikey_lock.sh '%E{ID_SERIAL}' '%E{ID_MODEL_ID}'"