Skip to content

Instantly share code, notes, and snippets.

View mpiannucci's full-sized avatar

Matthew Iannucci mpiannucci

View GitHub Profile
@mpiannucci
mpiannucci / inspectslice.go
Created November 9, 2015 18:22
Inspect Go Slice memeory layouts
package main
func InspectSlice(slice []string) {
// Capture the address to the slice structure
address := unsafe.Pointer(&slice)
// Capture the address where the length and cap size is stored
lenAddr := uintptr(address) + uintptr(8)
capAddr := uintptr(address) + uintptr(16)
@mpiannucci
mpiannucci / .vimrc
Last active November 21, 2017 19:19
Linux Config Files
" Try to determine type of file from name and contents
filetype plugin indent on
" Enable syntax highligting
syntax on
" Show partial commands on last line
set showcmd
" Highlight searches
@mpiannucci
mpiannucci / vectordoublevalidator.cpp
Last active July 17, 2017 19:21
A custom implementation of QDoubleValidator to allow comma-seperated numerical values
#include "vectordoublevalidator.h"
// VectorDoubleValidator Constructor
VectorDoubleValidator::VectorDoubleValidator ( double bottom, double top, int decimals,
QObject* parent = 0 )
: QDoubleValidator ( bottom, top, decimals, parent ) {
}
// Custom validate function to allow comma seperated values
@mpiannucci
mpiannucci / Keybindings.sublime-keymap
Last active November 21, 2017 19:26
Sublime-Text 3 User Settings
[
{ "keys": ["ctrl+q"], "command": "close_file" },
{ "keys": ["ctrl+k", "ctrl+0"], "command": "fold_all" },
]
@mpiannucci
mpiannucci / .htaccess
Created December 19, 2013 20:18
Dreamhost .htaccess file for a Web.py application
Options +ExecCGI
AddHandler cgi-script .py
DirectoryIndex code.py/
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/static/favicon.ico$
RewriteCond %{REQUEST_URI} !^/static/(.*)$
RewriteCond %{REQUEST_URI} !^(/.*)+code.py/
RewriteRule ^(.*)$ code.py/$1 [PT]