Skip to content

Instantly share code, notes, and snippets.

View creaktive's full-sized avatar
👽
🛸

Stanislaw Pusep creaktive

👽
🛸
View GitHub Profile
@creaktive
creaktive / net-curl.pl
Created August 25, 2011 18:35
AnyEvent::Net::Curl::Queued
#!/usr/bin/env perl
package AnyEvent::Net::Curl::Queued::Multi;
use common::sense;
use Moose;
use MooseX::NonMoose;
extends 'Net::Curl::Multi';
@creaktive
creaktive / lftp.pl
Created August 25, 2011 20:39
LFTP queue generator
#!/usr/bin/perl -w
use strict;
use MIME::Base64;
print <<EOHDR
set cmd:queue-parallel 10
set cmd:verbose no
set dns:cache-enable yes
set dns:cache-expire 24h
set http:user-agent 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.10) Gecko/20100922 Ubuntu/10.10 (maverick) Firefox/3.6.10'
@creaktive
creaktive / gist:1179783
Created August 30, 2011 00:27
Vim cheatsheet
(http://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/)
g_ → go to the last non-blank character of line
g* → works like * but doesn't add word boundaries to the search term
NG → Go to line N
= → auto indent
By default, word are composed of letter and the underscore character. If you want to use word in the meaning of group of letter separated by spaces, just use uppercases
We also can do things like ye, yank from here to the end of the word. But also y2/foo yank up to the second occurrence of “foo”.
@creaktive
creaktive / gen.sh
Created August 31, 2011 00:22
troll
perl -MEncode -MLWP::Simple -MURI::Escape -nE 'chomp;s/\s.*$//;if (/[áéíóú]sio$/) { my $w = $_; my $uri = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=" . uri_escape(decode_utf8($w)); if (get($uri) =~ m{"estimatedResultCount":"(\d+)"}s) { say "$1\t$w"} }' palavras.txt
sort -u -k2 senesio*.txt|sort -nr
while [ `echo 'show processlist;'|mysql -uroot -p12345|grep products.csv|wc -l` = 1 ]; do sleep 1; echo -n .; done; shutdown -h now
@creaktive
creaktive / gist:1200970
Created September 7, 2011 16:01
Mac OS X SSD hacks
launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist
rm /private/var/vm/swapfile*
cat > /Library/LaunchDaemons/com.stas.noatime.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
@creaktive
creaktive / gist:1237229
Created September 23, 2011 12:34
Data::Printer config
{
colored => 1,
return_value => 'pass',
caller_info => 1,
filters => {
-external => [qw(DateTime DB Digest JSON URI)],
},
};
@creaktive
creaktive / gist:1237982
Created September 23, 2011 17:43
Web Scraper framworks
https://metacpan.org/module/Scrappy
https://metacpan.org/module/Web::Scraper
https://github.com/assaf/scrapi
https://github.com/scrapy/scrapy
http://bithack.se/projects/methabot/
http://scrapy.org/
@creaktive
creaktive / setlist.txt
Created September 25, 2011 16:51
Stratovarius & Helloween @ São Paulo [06/may/2011]
SETLIST (STRATOVARIUS):
-----------------------
01. Intro
02. Infernal Maze
03. Eagleheart
04. Phoenix
05. The Kiss of Judas
06. Winter Skies
07. Under Flaming Skies
@creaktive
creaktive / hcp.pl
Created November 3, 2011 21:23
Hexagonal Close Packing
#!/usr/bin/env perl
use common::sense;
use Math::PlanePath::HexSpiral;
use Math::Trig qw(:pi);
use SDLx::App;
my $app = SDLx::App->new(
w => 800,
h => 600,