This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
#js minifier using google clojure WS api | |
#usages: | |
#./jsmin < file.js > file.min.js #input=stdin output=stdout | |
#./jsmin file.js #input=file.js output=file.min.js | |
#./jsmin file.js file.min.js #input=file.js output=file.min.js | |
use strict; | |
use warnings; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
#niko h[ost]i[nfo] | |
use strict; | |
use warnings; | |
use utf8; | |
use 5.010; | |
my $VERSION = '0.3'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEVID=`xinput list | grep -i touchpad | egrep -o 'id=(\w+)' | sed 's/id=//'` | |
[[ "$1" == "on" ]] && xinput set-prop $DEVID "Device Enabled" 1 | |
[[ "$1" == "off" ]] && xinput set-prop $DEVID "Device Enabled" 0 | |
echo -n "touchpad device #$DEVID " | |
if [[ "`xinput list-props $DEVID | grep -i enabled | egrep -o '\w$'`" == "1" ]] | |
then echo "is enabled" | |
else echo "is disabled" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#load token if previously saved | |
if( my $data = read_file( $tokenfile ) ) { | |
$self->{token} = $data; | |
} | |
#instanciate api with token_or_undef | |
$self->{api} = Net::OAuth2::Client->new( | |
$self->{client_id}, | |
$self->{client_secret}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
#html/php minifier - niko 2012 | |
#use: ./minify < tof.php > ../index.php | |
use strict; | |
use warnings; | |
use JSON; | |
use LWP::UserAgent; | |
use MIME::Base64; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Dancer; | |
#return memory used by the current pid | |
sub memused { | |
sysopen(my $fh, "/proc/$$/statm", 0) or die $!; | |
sysread($fh, my $line, 255) or die $!; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use Dancer; | |
use Data::Dump; | |
prefix '/test'; | |
get '/' => sub { | |
my $params = params; | |
"<pre>params:" . Data::Dump::dump($params) . "</pre>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use Inline C; | |
#use Benchmark qw(:all); | |
local $/=undef; | |
my $file=$ARGV[0] or die("you must specify a file"); | |
open my $fh, "<", $file; | |
my $text=<$fh>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# niko's zsh conf | |
### VARIABLES | |
HISTFILE=~/.histfile | |
HISTSIZE=1000 | |
SAVEHIST=1000 | |
export EDITOR="vim" | |
export PAGER="vimpager" | |
export PATH="${PATH}:${HOME}/bin" |
NewerOlder