Skip to content

Instantly share code, notes, and snippets.

<?php
$permissions = array(
"owner_read" => 256,
"owner_write" => 128,
"owner_delete" => 64,
"group_read" => 32,
"group_write" => 16,
"group_delete" => 8,
"other_read" => 4,
@xaprb
xaprb / lowercase_string.go
Created January 8, 2015 13:20
lowercase_string.go
package main
import (
"database/sql"
"database/sql/driver"
"errors"
_ "github.com/go-sql-driver/mysql"
"log"
"strings"
)
@xaprb
xaprb / hello_mysql.go
Created January 8, 2015 12:48
hello_mysql.go
package main
import (
"database/sql"
"log"
_ "github.com/go-sql-driver/mysql"
)
func main() {
db, err := sql.Open("mysql", "root:@tcp(:3306)/test")
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use DBI;
use English qw(-no_match_vars);
use Getopt::Long;
use List::Util qw(max);
/*
* Copyright (C) 2004 Baron Schwartz <baron at sequent dot org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Lingua::EN::Fathom;
use TeX::Hyphen;
use List::Util qw(min);
@xaprb
xaprb / make-load.sh
Created November 18, 2015 19:34
A little shell script for hammering the dvdstore database on Postgres
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: $0 <iterations>"
exit 1
fi
# Display product ID, category, title, price, num orders
# ordered by top products limit 10
function top_products(){
Attribute VB_Name = "ModStdIO"
Option Explicit
Private Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Long) As Long
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, _
lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, _
lpNumberOfBytesRead As Long, lpOverlapped As Any) As Long
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, _
lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, _
lpNumberOfBytesWritten As Long, lpOverlapped As Any) As Long
@xaprb
xaprb / stylebot.css
Last active March 10, 2022 20:38
Make GMail's design less horrendous using Stylebot
#gb {
background-color: #4285f4;
box-shadow: 0 0 4px rgba(0,0,0,.14), 0 4px 8px rgba(0,0,0,.28);
}
.zA.yO {
background-color: white;
box-shadow: 0 0 4px rgba(0,0,0,.14);
}