Skip to content

Instantly share code, notes, and snippets.

View bigpresh's full-sized avatar

David Precious bigpresh

View GitHub Profile
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 / 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
@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 / 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 / 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');
[davidp@supernova:~/dev/<projectdir>]$ git-push
Pushing to <repo-url-snipped>
To <repo-url-snipped>
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to '<repo-url-snipped>'
Dancer is a Perl framework for building web applications with minimal effort. It
started as a port of Ruby's Sinatra project, but has grown on its own path. A
Dancer app can run as a standalone Web server or from any webserver using PSGI,
and lets the user write an application with very few lines of code. It's
powerful and flexible enough to knock up a simple website or web service very
quickly, and can scale to much larger projects.
Building a Web application with Dancer is as easy as loading the library and
defining route handlers. Dancer provides an elegant syntax for defining route
handlers, can render views with a variety of template engines, supports static
port: 4002
dsn: "dbi:SQLite:dbname=test.db"
#!/usr/bin/perl
use Dancer;
get '/' => sub {
"query string: " . request->env->{QUERY_STRING};
};
dance;
my @matches;
my @filenames = (...);
for my $filename (@filenames) {
open(my $fh, '<', $filename) or die "Failed to open $filename - $!";
while (my $line = <$fh>) {
if ($line =~ /foo/) {
push @matches, $line;
}
}