Skip to content

Instantly share code, notes, and snippets.

View d1rk's full-sized avatar
🖖
Live long and prosper!

Dirk Brünsicke d1rk

🖖
Live long and prosper!
View GitHub Profile
@d1rk
d1rk / Useful git commands
Last active January 15, 2018 19:14 — forked from nas/Useful git commands
useful git commands
#push a local branch to repo if does not exist remotely
git push origin branch_name:refs/heads/branch_name
# to start tracking a branch
git branch --track branch_name origin/branch_name
# create remote git branch from head of master
git push origin origin:refs/heads/branch_name
# create a remote branch from another branch's head
@d1rk
d1rk / backupDb
Created February 21, 2011 15:50 — forked from AD7six/backupDb
mysqldump with database.php settings
#!/usr/bin/php
<?php
if (!defined('TMP')) {
define('TMP', getcwd() . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR);
}
$file = getcwd() . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'database.php';
if (!is_readable($file)) {
echo "Can't find database config at : $file\n";
die(1);
@d1rk
d1rk / Navigation.php
Created November 23, 2011 08:58 — forked from fahad19/Navigation.php
Admin navigation management in Lithium PHP framework
<?php
/**
* Navigation class for storing admin panel menu.
*
* @author Fahad Ibnay Heylaal <contact@fahad19.com>
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace core\storage;
use core\util\Set;
@d1rk
d1rk / .gitconfig
Created November 28, 2011 13:37
git useful tools
[alias]
st = status -sb
ci = commit
co = checkout
br = branch
lg = log --graph --pretty=format:'%C(yellow)%h%Creset -%Cblue%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
info = config --list
last = log --format=medium -n 5
rollback = reset HEAD~1
unindex = reset HEAD
@d1rk
d1rk / auth.conf
Created November 28, 2011 13:50
setup
AuthUserFile :vhosts/.htpasswd
AuthGroupFile /dev/null
AuthName ByPassword
AuthType Basic
<Limit GET>
require user d1rk
@d1rk
d1rk / gist:1731351
Created February 3, 2012 17:45 — forked from anonymous/gist:1731344
Wordpress in Li3
public function load()
{
global $PHP_SELF;
global $wp_embed;
global $wpdb;
$db = Connections::get('default', array('config'=>true));
//set connection to inboundink database just so it has a valid connection for now
//when actually doing something, it will connect to the appropriate db
define('DB_HOST', $db['host'] );
define('DB_NAME', $db['database'] );
@d1rk
d1rk / example.php
Created March 27, 2012 13:32
parsing an xdebug dump into something meaningful
<?php
xdebug_start_trace('/tmp/mytrace');
// do stuff
xdebug_stop_trace();
?>
@d1rk
d1rk / blowfish.php
Created May 14, 2012 09:21 — forked from xeoncross/blowfish.php
blowfish hashing using PHP's crypt and mcrypt library
<?php
# From my question and answer at SO:
# http://stackoverflow.com/questions/10183103/security-of-generating-hash-salts-using-phps-mt-rand
function blowfish($string, $salt = NULL, $iterations = '12')
{
return crypt($string, $salt ?: "$2a\$$iterations$" . md5(mcrypt_create_iv(22, MCRYPT_DEV_URANDOM)));
}
@d1rk
d1rk / cron.php
Created May 16, 2012 14:28 — forked from tmaiaroto/cron.php
Lithium Cron Wrapper
<?php
/**
* This script is meant to be executed via crontab.
* It should help you easily set li3 commands as cron jobs.
*
* You should put this in the root of your application.
* However, you don't need to, but you would then need to
* pass a --path= option with the path to your app.
* This is because the li3 console command must be called
* from a specific location.
@d1rk
d1rk / errors.php
Created August 28, 2012 18:46 — forked from rmarscher/errors.php
li3 airbrake in errors bootstrap
<?php
use lithium\action\Response;
use lithium\core\Environment;
use lithium\core\ErrorHandler;
use lithium\core\Libraries;
use lithium\console\Response as ConsoleResponse;
use lithium\net\http\Media;
use lithium\analysis\Logger;
use lithium\net\http\Service;