This file contains 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 | |
# ansi2unicode.pl | |
# 4/18/2007 | |
# | |
# convert an ANSI file to unicode, suitable for display in irssi/mirc or html | |
# usage: ansi2unicode.pl inputfile [-tc] [-o outputmode] [outputfile] | |
# -t = terminal output, no color | |
# -o = output mode, currently only html and irc supported, default is irc | |
# outputfile = filename to output to if html specified |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <libpq-fe.h> | |
#include <sys/time.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#include <string.h> | |
// channel to LISTEN on | |
const char *listenChannel = "foo"; |
This file contains 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
Add the following to your base ResultSet class: | |
# fast row estimation function for postgres | |
# similar to ->count, but may be much faster for Pg < 9.2 | |
# uses query planner row count estimation, accuracy depends on when | |
# ANALYZE/autovacuum was last performed on the table | |
# more info: http://wiki.postgresql.org/wiki/Count_estimate | |
sub estimate_count { | |
my ($self) = @_; |
This file contains 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
y/01/_*/,print for map{sprintf("%011b\n",$_)}(32,32,80,136,260,1539,260,136,80,32,32) | |
# 41558682057254037406452518895026208 = bitmap of 0=_,1=*, packed as 11-bit lines | |
# 11-bit chunks: 32 32 80 136 260 1539 260 136 80 32 32 | |
# %011b gives: | |
# 00000100000 | |
# 00000100000 | |
# 00001010000 | |
# 00010001000 | |
# 00100000100 |
This file contains 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
0000000100000f2e subq $8, %rsp | |
0000000100000f32 xorl %r12d, %r12d | |
0000000100000f35 leaq 68(%rip), %r14 | |
0000000100000f3c movl $42, %r15d | |
new_line: | |
0000000100000f42 movswl (%r14,%r12,2), %r13d | |
0000000100000f47 xorl %ebx, %ebx | |
new_col: | |
0000000100000f49 btl %ebx, %r13d | |
0000000100000f4d movl $95, %edi |
This file contains 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 | |
# installs plenv, perl, carton, cpanminus, sets up environment in .bash_profile | |
# from https://github.com/tokuhirom/plenv#readme | |
PLENV_PERL_VERSION='5.18.1' | |
if [[ -n "$PERL_MB_OPT" ]]; then | |
echo "You must unset your local::lib environment variables first" |
This file contains 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
.section .rodata | |
.hellostr: | |
.string "Hello, world\n" | |
.text | |
.globl _start | |
_start: | |
pushq %rbp | |
movq %rsp, %rbp |
This file contains 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 | |
# usage: bin/slackmsg "blah blah blah" => #engineering | |
# escape message for JSON: | |
MSG=$(printf '%q' $*) | |
echo $MSG | |
PAYLOAD="payload={\"channel\": \"#engineering\", \"username\": \"engbot\", \"text\": \"$MSG\", \"icon_emoji\": \":shipit:\"}" | |
echo $PAYLOAD |
This file contains 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
use vars qw/$VERSION %IRSSI/; | |
use strict; | |
use warnings; | |
$VERSION = '0.01'; | |
%IRSSI = ( | |
authors => 'revmischa', | |
name => "shitlink", | |
description => 'Prevents visiting of shit links', | |
license => "BSD", |
This file contains 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 | |
# convert postgres slow query log query w/ separate 'parameters:' line into an executable EXPLAIN ANALYZE query | |
use strict; | |
use warnings; | |
use Data::Dump qw/ddx/; | |
my $qfile = shift @ARGV or die "query file required"; |