Skip to content

Instantly share code, notes, and snippets.

View mipmip's full-sized avatar
🐟

Pim Snel mipmip

🐟
View GitHub Profile
@mipmip
mipmip / quick_and_dirty_logging.php
Created February 16, 2012 12:12
Quick and dirty logging in PHP
<?php
function log($msg)
{
//using the date() function
$time = date("F jS Y, h:iA");
//$remote_addr is PHP variable to get ip address
$ip = $REMOTE_ADDR;
@mipmip
mipmip / cli-with-options-and-arguments.rb
Created February 16, 2012 12:13
Ruby cli script with options and arguments example
#!/usr/bin/env ruby
# A script that will pretend to resize a number of images
require 'optparse'
# This hash will hold all of the options
# parsed from the command-line by
# OptionParser.
options = {}
optparse = OptionParser.new do|opts|
@mipmip
mipmip / close-all-running-apps.scpt
Created February 16, 2012 12:15
Mac OS X: close all running applications
tell application "System Events" to set quitapps to name of every application process whose visible is true and name is not "Finder"
repeat with closeall in quitapps
quit application closeall
end repeat
@mipmip
mipmip / gist:1844475
Created February 16, 2012 12:21
iptables block-release-single-port
iptables -A INPUT -p tcp -i eth0 -d 22.22.22.22 --dport 1935 -j REJECT
iptables -L
iptables -D INPUT 2
@mipmip
mipmip / buildTSFE.php
Created April 4, 2012 11:25
create TSFE object for use in backend (thanks to Christian Müller)
<?php
/**
* Initializes <code>$GLOBALS['TSFE']</code> the FE object to use in the backend
*
* @return void
*/
function buildTSFE($pid = 1) {
//needed for TSFE
require_once(PATH_t3lib.'class.t3lib_timetrack.php');
@mipmip
mipmip / killBPAccessd.sh
Created May 14, 2012 08:42
Kill Billings Pro Server BPAccessd
# Kill BPAccessd to be used in cron script
sudo kill -9 ` ps aux | grep BPAccessd | awk '{print $2}'`
ps aux | grep BPAccessd
@mipmip
mipmip / createMd5Password.rb
Created June 11, 2012 17:38
Ruby AppScript to generate password and store them in Apple Numbers
#!/usr/bin/env ruby
#
# Copyright $Author: pim $
# Last revision $Revision: 12506 $
# Last date $Date: 2012-06-09 22:57:41 +0200 (Sat, 09 Jun 2012) $
# CONFIGURE HERE
count=7010 # amount of password to generate
@mipmip
mipmip / dam-recursive-selections.tsconfig
Created June 18, 2012 22:05
Put this in the TSCONFIG of the Media Page to make selections recursive and have multiple filters
tx_dam.selections.txdamCat.sublevelDepth = 99
tx_dam.selections.default.modeSelIcons = 1
@mipmip
mipmip / autoCreateMailRule.applescript
Created June 27, 2012 22:37
Auto create mail rules
-- TODO fix make move to mailbox rule
-- TODO set condition
tell application "Mail"
set theseMessages to (get selection)
repeat with thisMessage in theseMessages
set theSender to sender of thisMessage
set SenderName to extract name from sender of thisMessage
@mipmip
mipmip / gist:3760743
Created September 21, 2012 10:08
TYPO3 PAGETS: show PageId's in BE PageTree
options.pageTree.showPageIdWithTitle = 1