Skip to content

Instantly share code, notes, and snippets.

<?php
/*
cakephp 1.2 database configuration for different environments
@author AgBorkowski
@link http://blog.aeonmedia.eu/2013/02/good-way-to-change-in-easy-way-application-environment
*/
class DATABASE_CONFIG {
public $default = array();
# skipp it if you wont change mirror of repository
curl https://raw.github.com/gist/1588091/8b7b7a203074231f3dc75bdee48b3017078fb621/CentOS-Base.repo -o /etc/yum.repos.d/CentOS-Base.repo
curl https://raw.github.com/gist/1588091/2e5ab750cd0603dd7210ea7a999d15f9aadae711/epel.repo -o /etc/yum.repos.d/epel.repo
@agborkowski
agborkowski / bst.js
Created December 5, 2012 11:39 — forked from trevmex/bst.js
A simple binary search tree in JavaScript
/*
* File: bst.js
*
* A pure JavaScript implementation of a binary search tree.
*
*/
/*
* Class: BST
*
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@agborkowski
agborkowski / g11n.php
Created October 12, 2012 17:32
Lithiumphp::g11n::tld
/**
* @author AgBorkowski <[email protected]>
* @link http://blog.aeonmedia.eu
*/
/**
* Locales
*
* Adds globalization specific settings to the environment. The settings for
* the current locale, time zone and currency are kept as environment settings.
@agborkowski
agborkowski / gist:3467776
Created August 25, 2012 16:48
c::max write speed::ssd
#include <stdio.h>
const unsigned long long size = 8ULL*1024ULL*1024ULL; unsigned long long a[size];
int main()
{
FILE* pFile;
pFile = fopen("file.binary", "wb");
for (unsigned long long j = 0; j < 1024; ++j){
//Some calculations to fill a[]
fwrite(a, 1, size*sizeof(unsigned long long), pFile); }
fclose(pFile);
@agborkowski
agborkowski / gist:3338134
Created August 13, 2012 08:18
php::http::force cache off
<?php
//@link http://www.paulund.co.uk/disable-http-cache-with-php
header("Content-Type: application/json");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
@agborkowski
agborkowski / gist:3338083
Created August 13, 2012 08:03 — forked from jaseg/gist:3334991
Password manager without a password manager

Prelude

Since password managers are big and complicated and I currently am pretty bored since I am sitting in a car for a few hours, here is a simple algorithm to generate resource-specific, unique passwords using a master password and no password database.

WARNING

It is 00:23 local time and I spent the part of the last night that I slept on a couch with loud music playing, so I would recommend you not to rely on my brilliant mind to produce a cryptographically secure algorithm at this time. I would, however, appreciate any comments and especially improvements of this algorithm. The first person to find a flaw has the honor to name the algorithm.

Usage

<?php
//@link http://codepad.viper-7.com/GOutvO
$data = array(1,2,3,1,3,99,99,4,5,3,2,1,99);
$duplicate = array();
foreach ($data as $a) {
array_pop($data);
foreach($data as $b){
if ($a == $b && !in_array($a,$duplicate)){
$duplicate[] = $b;
echo "duplicate {$a} <br />\r\n";
@agborkowski
agborkowski / .bash_profile
Created June 18, 2012 13:21
bash:profile:command: github push active branch to github, make new feature
# GitHub make new feature
ghf(){
git checkout master
git fetch github
git merge --ff github/master
git checkout -b $1 master
git push -u github $1
echo 'done'
}
# GitHub push new feature to github