Skip to content

Instantly share code, notes, and snippets.

View cb1kenobi's full-sized avatar

Chris Barber cb1kenobi

View GitHub Profile
@cb1kenobi
cb1kenobi / colors.reg
Created July 22, 2014 19:37
This is my custom sane color scheme for the Windows Command Prompt that makes colors easier to see
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe]
"QuickEdit"=dword:00000001
"ScreenBufferSize"=dword:270f0082
"WindowSize"=dword:002e0082
"FontSize"=dword:000e0007
"FontFamily"=dword:00000036
"FontWeight"=dword:00000190
"FaceName"="Consolas"
@cb1kenobi
cb1kenobi / gist:97253db17e46f814be86
Created October 20, 2014 21:07
Coda 2 vs Coda 2.5 indentation
Say you are editing an HTML file.
In Coda 2, if you type "<style>" and ENTER, the cursor lines up with the "<". If you type "foo {" and hit ENTER, the cursor lines up with "f".
In Coda 2.5, if you type "<style>" and ENTER, the cursor is tabbed in 1 level from the "<". Generally this is what you want. If you type "foo {" and hit ENTER, the cursor again is tabbed in 1 level from the "foo". The biggest annoyance is if I type "}", it doesn't automatically outdent.
@cb1kenobi
cb1kenobi / get-spam-blocklist
Last active August 29, 2015 14:10
Postfix CIDR blocklist update script
#!/usr/bin/env node
var http = require('http');
http.get({
hostname: 'www.spamhaus.org',
port: 80,
path: '/drop/drop.lasso'
}, function (res) {
if (res.statusCode !== 200) {
console.error('Failed to download http://www.spamhaus.org/drop/drop.lasso');
process.exit(1);
@cb1kenobi
cb1kenobi / update-spam-blocklist
Created May 30, 2015 00:52
Postfix CIDR blocklist update and spamassassin learn script
#!/bin/bash
curl https://www.spamhaus.org/drop/drop.lasso 2>/dev/null | sed '/^\s*;/d' | sed 's/;.*/REJECT/' > /etc/postfix/client.cidr
postfix reload
sa-learn -D --sync --spam /data/mail/cb1inc.com/chris/.Spam/{cur,new}
@cb1kenobi
cb1kenobi / mysql-virtual_mailboxes.cf
Created July 17, 2011 19:20
A better /etc/postfix/mysql-virtual_mailboxes.cf with + in email address support
user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM users u JOIN (SELECT '%s' AS orig_email) x ON u.email = CASE WHEN LOCATE('+', x.orig_email) > 0 AND LOCATE('+', x.orig_email) < LOCATE('@', x.orig_email) THEN CONCAT(SUBSTRING_INDEX(x.orig_email, '+', 1), '@', SUBSTRING_INDEX(x.orig_email, '@', -1)) ELSE x.orig_email END
hosts = 127.0.0.1
@cb1kenobi
cb1kenobi / GitHub_Widescreen.user.js
Created March 6, 2012 06:55
GitHub widescreen GreaseMonkey script
// ==UserScript==
// @name GitHub Widescreen
// @namespace http://github.com
// ==/UserScript==
(function() {
var style = document.createElement("style");
style.type = "text/css";
style.innerHTML = "body .container{width:95%;min-width:920px;}";
document.getElementsByTagName("head")[0].appendChild(style);
}());
@cb1kenobi
cb1kenobi / gist:2958313
Created June 20, 2012 05:43
Array.indexOf()
if (["bottom","height","left","right","top","width"].indexOf("width") != -1) {
// win
}
@cb1kenobi
cb1kenobi / gist:2958314
Created June 20, 2012 05:44
String.indexOf()
if (",bottom,height,left,right,top,width,".indexOf(",width,") != -1) {
// win
}
var values = {bottom:1,height:1,left:1,right:1,top:1,width:1};
if ("width" in values) {
// win
}
var values = {bottom:1,height:1,left:1,right:1,top:1,width:1};
if (values["width"]) {
// win
}