Skip to content

Instantly share code, notes, and snippets.

@lyoshenka
lyoshenka / git_for_marge.md
Last active August 29, 2015 13:55
Git for marge
  1. ssh -t marge@ts-dev.us "cd topscore; bash" - connect to server

  2. git fetch && git merge origin/master - get latest changes

  3. git add -A && git commit -m "message goes here" - commit changes

  4. git push - push changes

  5. ./symfony fs:snapshot s3 - load the latest database snapshot

MIME-Version: 1.0
Received: by 10.114.61.203 with HTTP; Wed, 5 Feb 2014 14:03:44 -0800 (PST)
Date: Wed, 5 Feb 2014 17:03:44 -0500
Delivered-To: REDACTED
Message-ID: <CAKko9b2cUKCDQaSJaJ930SOCe_88_0CQH6FU5_ZFm2qzk_pYtQ@mail.gmail.com>
Subject: image test
From: REDACTED
To: REDAcTED
Content-Type: multipart/related; boundary=14dae93d8c5e2a262104f1afee0f
@lyoshenka
lyoshenka / daemonize_anything.sh
Last active August 29, 2015 13:56 — forked from Radamanf/Ghost - Demonize anything
Turn any command into a daemon. Use this as an init.d script.
#!/bin/bash
# Licence: GPLv3, MIT, BSD, Apache or whatever you prefer; FREE to use, modify, copy, no obligations
# Description: Bash Script to Start the process with NOHUP and & - in background, pretend to be a Daemon
# Author: Andrew Bikadorov
# Script v1.5
# For debugging purposes uncomment next line
#set -x
@lyoshenka
lyoshenka / chicken.sh
Last active August 29, 2015 13:56
My simple timer to alert me when the chicken's ready to take out of the oven.
#!/bin/bash
FILENAME=$(basename "$0")
PID=$(pgrep -o "$FILENAME")
if [ "$1" = "-k" ]; then
MIN=$(ps -o start= -o cmd= -p "$PID" | cut -d' ' -f4)
if [[ "$MIN" =~ ^-?[0-9]+$ ]]; then
echo "Killing timer"
kill -9 "$PID"
@lyoshenka
lyoshenka / router.php
Created February 22, 2014 20:24 — forked from michalpipa/router.php
Router script to make Symfony2 work with the PHP built-in server
<?php
if (isset($_SERVER['SCRIPT_FILENAME'])) {
return false;
} else {
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT']
. DIRECTORY_SEPARATOR
. 'app.php'
;
@lyoshenka
lyoshenka / autosubmit.js
Created February 28, 2014 21:51
How to autosave a form field as it's being edited. This will fire the ajax request 400ms after the person stops typing.
// inspired by http://stackoverflow.com/questions/2006870/submit-form-with-delay-while-entering-data-into-input-field
/*
var timerid;
jQuery("#searchForm").keyup(function() {
var form = this;
clearTimeout(timerid);
timerid = setTimeout(function() { form.submit(); }, 500);
});
*/
@lyoshenka
lyoshenka / chef-solo.sh
Created March 23, 2014 18:26
Chef Solo bootstrap. Quickly set up chef solo (and liquidprompt) on a new machine
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install git-core curl
git clone https://github.com/nojhan/liquidprompt.git
source ~/liquidprompt/liquidprompt
echo 'source ~/liquidprompt/liquidprompt' >> ~/.bashrc
\curl -sSL https://get.rvm.io | bash -s stable --ruby
source /usr/local/rvm/scripts/rvm
sudo apt-get install libxslt-dev libxml2-dev
@lyoshenka
lyoshenka / disk_space.sh
Created March 24, 2014 13:37
Send yourself an email when your root disk fills up
#!/bin/bash
disk_space=`df -h | grep -oP "[0-9]+(?=% /$)"`
[[ "$disk_space" -ge 90 ]] && { echo "Root disk is $disk_space% full" | mail alex@usetopscore.com -s "SERVERNAME Root Disk $disk_space% full" ; }
<?php
function append_error_handler($handler) {
set_error_handlers(array(set_error_handler($handler), $handler));
}
function prepend_error_handler($handler) {
set_error_handlers(array($handler, set_error_handler($handler)));
}
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select