Skip to content

Instantly share code, notes, and snippets.

@socketbox
socketbox / 960gs.scss
Created June 30, 2012 20:35 — forked from jmblog/960gs.scss
960gs.scss
/*-----------------------------------------------------
960 Grid System ~ Core CSS.
Learn more ~ http://960.gs/
Licensed under GPL and MIT.
-------------------------------------------------------*/
/* Grid Settings
---------------------------*/
// 12-column grid
@socketbox
socketbox / cherryd.cfg
Created July 1, 2012 19:31
cherryd config
[global]
server.socket_host: "127.0.0.1"
server.socket_port: 8080
log.error_file = '/Users/chb/code/lpn-dot-com/test/log/cherrypy.error.log'
log.access_file = '/Users/chb/code/lpn-dot-com/test/log/cherrypy.access.log'
[/]
tools.staticdir.debug: True
tools.staticdir.root: '/Users/chb/code/lpn-dot-com'
@socketbox
socketbox / pasteboard.py
Created July 22, 2012 22:50
PasteBoard
#!/usr/bin/python
#code taken from http://www.macdrifter.com/2011/12/python-and-the-mac-clipboard/
def pbcopy(s):
"Copy string argument to clipboard"
board = AppKit.NSPasteboard.generalPasteboard()
board.declareTypes_owner_([AppKit.NSStringPboardType], None)
newStr = Foundation.NSString.stringWithString_(s)
newData = \

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@socketbox
socketbox / progress_query.sql
Created October 24, 2014 18:31
SQL Server Command Progress Query
SELECT r.session_id,r.command,
CONVERT(NUMERIC(6,2),r.percent_complete)
AS [Percent Complete],CONVERT(VARCHAR(20),DATEADD(ms,r.estimated_completion_time,GetDate()),20) AS [ETA Completion Time],
CONVERT(NUMERIC(10,2),r.total_elapsed_time/1000.0/60.0) AS [Elapsed Min],
CONVERT(NUMERIC(10,2),r.estimated_completion_time/1000.0/60.0) AS [ETA Min],
CONVERT(NUMERIC(10,2),r.estimated_completion_time/1000.0/60.0/60.0) AS [ETA Hours],
CONVERT(VARCHAR(1000),(SELECT SUBSTRING(text,r.statement_start_offset/2,
CASE WHEN r.statement_end_offset = -1 THEN 1000 ELSE (r.statement_end_offset-r.statement_start_offset)/2 END)
FROM sys.dm_exec_sql_text(sql_handle)))
FROM sys.dm_exec_requests r WHERE command IN ('RESTORE DATABASE','BACKUP DATABASE')
@socketbox
socketbox / gist:b2c5e6dafe54565d2552
Created November 7, 2014 21:52
Silly Bash Tricks
# tar files to a remote destination
tar czf - . | ssh remote "( cd /somewhere ; cat > file.tar.gz )"
@socketbox
socketbox / drop_db_mssql2008.sql
Created November 11, 2014 16:13
Drop database in MS SQL Server 2008
USE master;
ALTER DATABASE [db_name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
DROP DATABASE [db_name];
@socketbox
socketbox / gist:17a3e90e836f09d71f99
Created September 22, 2015 12:39
Diff two directories on Windows Server with PowerShell
$fso = Get-ChildItem -Recurse -path C:\fso
$fsoBU = Get-ChildItem -Recurse -path C:\fso_BackUp
Compare-Object -ReferenceObject $fso -DifferenceObject $fsoBU

Keybase proof

I hereby claim:

  • I am socketbox on github.
  • I am chb (https://keybase.io/chb) on keybase.
  • I have a public key ASCl2ulrlMT_HOe0YGLssnXbJHQgK_JMMVU8zT64pIrrJAo

To claim this, I am signing this object:

#include <iostream>
#include <stdio.h>
#include <limits>
int main()
{
std::cout << "Integers: \n";
std::cout << "\tType\t\tSize (Bits)\tLowest\t\tMin\t\tMax\n";
std::cout << "____________________________________________________________________________\n";