Skip to content

Instantly share code, notes, and snippets.

Mark Platt mrkplt

Block or report user

Report or block mrkplt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mrkplt
mrkplt / com.mrkplt.sockfix.plist
Created Oct 19, 2011
Startup script that allows you to use the built in mysql server with Snow Leopard Server and Liip PHP (http://php-osx.liip.ch/) by symlinking the mysql.sock location to where php expects it to be. Goes in /Library/LaunchDaemons. Restart the server.
View com.mrkplt.sockfix.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.mrkplt.sockfix</string>
<key>Program</key>
<string>/bin/ln</string>
<key>ProgramArguments</key>
<array>
@mrkplt
mrkplt / gist:2715219
Created May 17, 2012
Rails App init with test framework
View gist:2715219
$ rails new <app_name> --skip-test-unit
$ cd <app_name>/
$ git init
$ git add .
$ git commit -m 'first commit'
$ git remote add origin <git repo>
$ git push -u origin master
$ mate .
/**
@mrkplt
mrkplt / unicorn_example.sh
Created Jun 21, 2012 — forked from tualatrix/unicorn_example.sh
An example of unicorn init script for Ubuntu
View unicorn_example.sh
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn web server
# Description: starts unicorn
@mrkplt
mrkplt / ldap_auth.rb
Created Jul 31, 2013
Ruby script using Net::LDAP (net/ldap) to authenticate a users account name against an ldap server. This is tested against an AD domain. user@example.com is not the user_name our domain expected. Your milage may vary. Credit to a bunch of tutorials for getting this to work (whose tabs I sadly closed). This shoudl enable you with the right creden…
View ldap_auth.rb
require 'net/ldap'
require 'io/console'
class LDAPUser
def connect(user_name, password)
ldap = Net::LDAP.new(:host => 'example.com', :port => 389)
ldap.auth("CN=#{user_name},OU=Users,DC=example,DC=com", password)
begin
@mrkplt
mrkplt / do-___-end.sublime-snippet
Created Dec 5, 2013
doe <tab> creates a do end block in Sublime Text 2. Put this file in ~/Library/Application Support/Sublime Text 2/Packages/Ruby/
View do-___-end.sublime-snippet
<snippet>
<content><![CDATA[
do
${1}
end]]></content>
<description>do...end block</description>
<tabTrigger>doe</tabTrigger>
<scope>source.ruby</scope>
</snippet>
@mrkplt
mrkplt / signal_trapping_example.rb
Created Dec 16, 2013
A lil script for playing with signal trapping on *nix machines.
View signal_trapping_example.rb
hello = 'Hello'
puts Process.pid
while true
Signal.trap('USR1'){
hello = 'HALLO!'
}
Signal.trap('USR2'){
hello = 'Hello'
}
@mrkplt
mrkplt / threads_and_signals.rb
Last active Dec 31, 2015
Same as https://gist.github.com/mrkplt/7993228 except it spins up threads to do things in.
View threads_and_signals.rb
@hello = 'Hello'
puts Process.pid
thread_array = Array.new
thread_array << Thread.new do
Signal.trap('USR1'){
@hello = 'HALLO!'
}
Signal.trap('USR2'){
View install-redis.sh
#!/bin/bash
###############################################
# To use:
# wget -O install-redis.sh https://gist.github.com/mrkplt/8137324/raw
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
echo " 1. Prerequisites: Install updates, set time zones, install GCC and make"
echo "*****************************************"
View redis-server
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@mrkplt
mrkplt / ruby_2_install_at_amazon.rb
Last active Jan 2, 2016
Pulls ruby 1.8.7 out of the amazon instance. Installs 2.0.
View ruby_2_install_at_amazon.rb
#!/bin/bash
# I don't know if this will actually run as a script, but I threw the shebang in anyway
# executing the individual step works fine.
###############################################
# To use:
# wget -O install-ruby-2.sh https://gist.github.com/mrkplt/8229498/raw
# chmod 755 install-ruby-2.sh
# sudo ./install-ruby-2.sh
###############################################
sudo yum -y update
You can’t perform that action at this time.