Skip to content

Instantly share code, notes, and snippets.

View bigpresh's full-sized avatar

David Precious bigpresh

View GitHub Profile
@bigpresh
bigpresh / hashes.pl
Created July 7, 2015 15:42
20k hashes memory usage
[davidp@supernova:~]$ cat tmp/hashes.pl
#!/usr/bin/perl
#
use Memory::Usage;
my $mu = Memory::Usage->new();
# Record amount of memory used by current process
$mu->record('before creating hashes');
@bigpresh
bigpresh / put-server.pl
Created February 4, 2015 09:40
Test case for utrack's JSON-PUTting Dancer2 problem
#!/usr/bin/perl
#
use lib '/home/davidp/dev/github/Dancer2/lib';
use Dancer2;
set serializer => 'Mutable';
put '/put' => sub {
warn "request body: " . request->body;
warn "hi: " . params->{hi};
@bigpresh
bigpresh / fdisk on GPT'd drive
Created September 29, 2014 10:26
fdisk showing the protective MBR on a GPT drive
[davidp@supernova:~]$ sudo fdisk -l /dev/sdb
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/sdb: 3000.6 GB, 3000592982016 bytes
256 heads, 63 sectors/track, 363376 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
@bigpresh
bigpresh / adb.log
Created March 6, 2014 12:51
CM 11 browser goes boom
I/ActivityManager( 2839): Timeline: Activity_launch_request id:com.android.browser time:1027133
I/ActivityManager( 2295): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.android.browser/.BrowserActivity bnds=[0,1156][160,1283]} from pid 2839
V/Zygote ( 6369): Switching descriptor 32 to /dev/null
V/Zygote ( 6369): Switching descriptor 10 to /dev/null
I/ActivityManager( 2295): Start proc com.android.browser for activity com.android.browser/.BrowserActivity: pid=6369 uid=10094 gids={50094, 3003, 1028, 1015}
V/WebViewChromium( 6369): Binding Chromium to the main looper Looper (main, tid 1) {41a68aa8}
I/chromium( 6369): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
I/BrowserProcessMain( 6369): Initializing chromium process, renderers=0
D/libEGL ( 6369): loaded /system/lib/egl/libEGL_mali.so
D/libEGL ( 6369): loaded /system/lib/egl/libGLESv1_CM_mali.so
Downloading device's PIT file...
PIT file download successful.
Entry Count: 15
Unknown 1: 0
Unknown 2: 0
Unknown 3: 0
Unknown 4: 0
Unknown 5: 0
Unknown 6: 0
@bigpresh
bigpresh / countries.json
Created December 11, 2013 13:24
A list of all countries and all states within them, generated by a Perl script using Locale::SubCountry (also included in this gist). May be helpful for people building web apps which want to provide dropdowns of countries and states/counties.
{
"AD" : {
"name" : "Andorra",
"states" : {
"02" : "Canillo",
"03" : "Encamp",
"04" : "La Massana",
"05" : "Ordino",
"06" : "Sant Julià de Lòria",
"07" : "Andorra la Vella",
#!/usr/bin/perl
my $arrayinfo = <<'ARRAYINFO';
Copyright (c) 2010 LSI
LSI/3ware CLI (version 2.00.11.016)
//monitor> info c0
Unit UnitType Status %RCmpl %V/I/M Stripe Size(GB) Cache AVrfy
------------------------------------------------------------------------------
@bigpresh
bigpresh / WelcomeMibbit.pm
Created July 11, 2013 16:09
Mibbit-user-welcoming code from sophie
package Bot::BasicBot::Pluggable::Module::WelcomeMibbit;
use strict;
use base 'Bot::BasicBot::Pluggable::Module';
sub help {
return <<HELPMSG
Customised welcome to Mibbit users.
Invites them to change their nick and ask for any help they need.
@bigpresh
bigpresh / lroe.pl
Created December 20, 2012 15:48
Example for lroe
#!/usr/bin/perl
use strict;
use Data::Dump;
my %values;
for (<DATA>) {
/^
\s*
@bigpresh
bigpresh / fork.pl
Created November 28, 2012 21:13
testing forking in route handler
#!/usr/bin/perl
use Dancer;
get '/' => sub {
fork and return "Content!\n";
sleep 10;
warn "Child process done\n";