Skip to content

Instantly share code, notes, and snippets.

View r15ch13's full-sized avatar
👷‍♂️

Richard Kuhnt r15ch13

👷‍♂️
View GitHub Profile
@r15ch13
r15ch13 / Bcrypt.php
Created June 26, 2012 18:33
Simple PHP 5.3+ Bcrypt class and functions
<?php
/*
By Marco Arment <me@marco.org>.
This code is released in the public domain.
THERE IS ABSOLUTELY NO WARRANTY.
Usage example:
// In a registration or password-change form:
@r15ch13
r15ch13 / transmission-daemon.sh
Created September 6, 2012 20:10
Transmission Startscript
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: transmission-daemon
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop the transmission-daemon.
### END INIT INFO
@r15ch13
r15ch13 / snippet.xml
Created September 28, 2012 09:46 — forked from JeffreyWay/snippet.xml
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
@r15ch13
r15ch13 / gist:4059596
Last active October 12, 2015 17:08
Saferpay cURL Issue
<?php
error_reporting(E_ALL);
ini_set("display_errors", "on");
$url = "https://www.saferpay.com/user/FileImport/ScriptUpload.aspx";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@r15ch13
r15ch13 / gist:4091412
Created November 16, 2012 22:19
Laravel Git Deployment
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
echo
echo "**** Pulling changes into Live [Hub's post-update hook]"
echo
@r15ch13
r15ch13 / gist:4111022
Created November 19, 2012 14:45 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@r15ch13
r15ch13 / gist:4111024
Created November 19, 2012 14:45 — forked from hileon/gist:1311735
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Windows)

General

Ctrl+KB toggle side bar
Ctrl+Shift+P command prompt
Ctrl+` python console
Ctrl+N new file

Editing

@r15ch13
r15ch13 / gist:4389097
Created December 27, 2012 15:36
Saferpay cURL Issue
<?php
// Workaround
$cmd = sprintf("curl -F 'spUsername=%s' -F 'spPassword=%s' -F 'UAFState=login' -F 'CustomerID=%s' -F 'file=%s' %s",
'e99867001',
'XAjc3Kna',
'99867',
'@/Users/Test/Sites/saferpay/99867-GL01.IN',
'https://www.saferpay.com/user/FileImport/ScriptUpload.aspx'
);
$result = array();
@r15ch13
r15ch13 / phpunit.sh
Created January 18, 2013 20:23
Report phpunit status to blink1
#!/bin/bash
CMD='phpunit.phar --colors'
if $CMD; then
nohup blink1-tool --rgb 0,255,0 --blink 5 &> /dev/null &
else
nohup blink1-tool --rgb 255,0,0 --blink 5 &> /dev/null &
fi
@r15ch13
r15ch13 / runonce_helper.php
Last active December 14, 2015 16:29
Useful for cronjobs, to run only once at the same time.
<?php
function runonce($name, Closure $closure)
{
$lockname = $name . '.pid';
try {
if(!Cache::has($lockname)) {
Cache::forever($lockname, getmypid());
if ($closure instanceof Closure) {
$closure = call_user_func($closure);