Skip to content

Instantly share code, notes, and snippets.

@HomenSimpsor
HomenSimpsor / textLine.vim
Last active December 14, 2015 15:48
Act on lines that aren't surrounded by punctuation
:%s`\v(^\s+)@<=([a-z])@=`<p>` " put <p> at the beginning of every line that starts with a-z
:%s`\v[a-z]@<=$`</p>` " put a </p> on the end
@HomenSimpsor
HomenSimpsor / formatSql.vim
Created March 8, 2013 19:37
Assuming the SQL has capitalized keywords
:set noic
:s`\v\s@<=[A-Z]@=`^M`g
@HomenSimpsor
HomenSimpsor / gitCron.sh
Created March 19, 2013 12:41
Midnight rollout of new branch via cron
0 0 * * * /usr/local/bin/git --git-dir=/hsphere/local/home/user/domain.com/.git checkout -f v1.2
@HomenSimpsor
HomenSimpsor / mediawiki.css
Last active December 16, 2015 09:48
Override styles for MediaWiki's default "Vector" theme
/**
* Explicit fonts
*/
div,
td,
li,
p {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
@HomenSimpsor
HomenSimpsor / mailchimp.txt
Created May 1, 2013 13:51
Minimal version of a Mailchimp accepted text only newsletter
Hello
Sincerely,
Organization name
*|LIST:ADDRESS|*
*|LIST:PHONE|*
Update your profile:
#!/bin/bash
# vim7.4
./configure --disable-selinux \
--enable-perlinterp \
--enable-pythoninterp \
--with-python-config-dir=/usr/lib/python2.7/config \
--enable-python3interp \
--enable-rubyinterp \
--enable-multibyte \
@HomenSimpsor
HomenSimpsor / howMany.js
Created August 23, 2013 20:24
How many letters can be generated from an n-word diceware phrase
function howMany(n) {
var L = Math.pow(7776, n);
var num = Math.log(L);
var den = Math.log(26);
var total = num / den;
//console.log("result", L, num, den, total);
console.log("A diceware phrase of", n, "words will give", total, "letters")
}
<?php
ini_set('display_errors', 'On');
ini_set('html_errors', 0);
error_reporting(-1);
function ShutdownHandler()
{
if(@is_array($error = @error_get_last()))
{
return(@call_user_func_array('ErrorHandler', $error));
#include <stdio.h>
void subtract(float, float); /* the function prototype */
int main()
{
void MAXCOUNT(float, float); /* the function prototype */
<?php
/*
Function change password in htpasswd.
Arguments:
$user > User name we want to change password to.
$newpass > New password
$type > Type of cryptogrphy: DES, SHA, MD5.
$salt > Option: Add your custom salt (hashing string).
Salt is applied to DES and MD5 and must be in range 0-9A-Za-z
$oldpass > Option: Add more security, user must known old password to change it.