Skip to content

Instantly share code, notes, and snippets.

View neerolyte's full-sized avatar

David Schoen neerolyte

View GitHub Profile
@neerolyte
neerolyte / gist:1269193
Created October 7, 2011 01:13
working vm
root@drudge:/etc/libvirt/qemu# cat monit.lyte.xml
<domain type='kvm'>
<name>monit.lyte</name>
<uuid>63001546-440a-f2d2-ebec-fdacb25b1d96</uuid>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc-0.14'>hvm</type>
<boot dev='hd'/>
@neerolyte
neerolyte / gist:1273113
Created October 9, 2011 00:37
Connections back to the same thread...
// Produces:
// Error: ECONNREFUSED, Connection refused
// at Client._onConnect (net.js:601:18)
// at IOWatcher.onWritable [as callback] (net.js:186:12)
var http = require('http')
var server = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello world\n');
@neerolyte
neerolyte / gist:1321130
Created October 27, 2011 22:48
Default 5.6 logrotate.conf
# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
dschoen@dave-xps 07 10:49:34 ~ 130
$ type prompt_command_lyte
prompt_command_lyte is a function
prompt_command_lyte ()
{
EXIT_STATUS="$?";
if [ $UID -eq 0 ]; then
FONT_USER=$FONT_RED;
else
FONT_USER=$FONT_GREEN;
@neerolyte
neerolyte / gist:1644379
Created January 20, 2012 01:27
half baked print_r in lua
function pp (o)
local typ = type(o)
if typ == "boolean" or typ == "number" then
return o
elseif typ == "string" then
return string.format( "%q", o)
elseif typ == "table" then
local t = { "{"}
for k, v in pairs ( o ) do
local nice = "[" .. pp(k) .. "]" .. " = " .. pp(v) .. ";"
@neerolyte
neerolyte / Guardfile
Last active December 14, 2015 23:39
First stab at getting guard to cleanly watch for inotify events outside of a Vagrant VM, send the event inside and report back on the outside again. See comments for more description.
require 'guard'
require 'guard/guard'
require 'guard/jasmine-node'
module ::Guard
class Guard
def vagrant_run_prefix()
prep_ssh_config
"ssh -F #{ssh_conf_file} default -- cd /vagrant\\;"
end
@neerolyte
neerolyte / gist:6395381
Last active December 22, 2015 01:19
Quick and dirty php code to enumerate subdomains using Google dorks
<?php
function docurl($url) {
$opts = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url,
CURLOPT_HEADER => true,
);
$ch = curl_init();
curl_setopt_array($ch, $opts);
@neerolyte
neerolyte / gist:6899314
Last active December 25, 2015 01:59
Segfaulting php when using pcntl functions and postgres
<?php
$dbh = new PDO("pgsql:dbname=test;user=postgres");
if (pcntl_fork()) {
// give child a moment to shutdown
usleep(200000);
// do anything with the db... segfault!
$dbh->query("select version();");
}
@neerolyte
neerolyte / google_sub_path_finder.php
Created March 3, 2014 04:40
quick and dirty php code to try to extract high level subpaths from google indexes
<?php
function docurl($url) {
$opts = array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url,
CURLOPT_HEADER => true,
);
$ch = curl_init();
curl_setopt_array($ch, $opts);
@neerolyte
neerolyte / vssh
Last active November 16, 2016 23:24
vssh - significantly faster ssh for vagrant
#!/bin/bash -e
# vssh - significantly faster Vagrant SSHing
# Usage: vssh [vagrant host] [regular ssh arguments]
# find the .vagrant directory scanning up from $PWD
find_vagrant_dir() {
cdir="$PWD"
while ! [[ -d "$cdir/.vagrant" ]] && [[ "$cdir" != "/" ]]; do
cdir="$(dirname "$cdir")"