Skip to content

Instantly share code, notes, and snippets.

View rudiedirkx's full-sized avatar

Rudie Dirkx rudiedirkx

View GitHub Profile
<?php
// $ps = `ps -axf -o pid,command | grep -C3 '\/chrome\/'`;
// $ps = `ps -axf -o pid,command | grep 'chrome' | grep -C1 -v '\\_'`;
$ps1 = '';
if ($pid1 = findPsPid($ps1)) {
sleep(20);
$ps2 = '';
if ($pid2 = findPsPid($ps2)) {
<?php
// sendmail_path="C:\XAMPP\php\php.exe C:\WWW\mailtodisk.php \"C:\XAMPP\mailoutput\__TIME__-__RAND__-__SUBJECT__.eml\""
// sendmail_path = "/usr/bin/php /var/www/mailtodisk.php \"/var/www/mailoutput/__TIME__-__RAND__-__SUBJECT__.eml\""
// file_put_contents(__DIR__ . '/mailtodisk.log', print_r($_SERVER, 1));
// Destination folder/filename is required
$destination = @$_SERVER['argv'][1];
if (!$destination) {
@rudiedirkx
rudiedirkx / line-lengths.php
Last active August 14, 2018 21:22
Line lengths for controllers and views recursively in a folder.
<?php
snap('init');
define('LL_TAB_SIZE', 4);
define('LL_TOO_LONG', 130);
define('LL_WAY_TOO_LONG', 220);
ini_set('html_errors', 0);
/* From https://gist.github.com/MadRabbit/996893 */
function Bezier(p1, p2, p3, p4) {
var Cx = 3 * p1,
Bx = 3 * (p3 - p1) - Cx,
Ax = 1 - Cx - Bx;
var Cy = 3 * p2,
By = 3 * (p4 - p2) - Cy,
Ay = 1 - Cy - By;
@harlantwood
harlantwood / push_to_github.rb
Created June 15, 2012 07:27
Commit and push via Github REST API, from ruby RestClient
# Committing changes to a repo via the Github API is not entirely trivial.
# The five-step process is outlined here:
# http://developer.github.com/v3/git/
#
# Matt Swanson wrote a blog post translating the above steps into actual API calls:
# http://swanson.github.com/blog/2011/07/23/digging-around-the-github-api-take-2.html
#
# I was not able to find sample code for actually doing this in Ruby,
# either via the HTTP API or any of the gems that wrap the API.
# So in the hopes it will help others, here is a simple function to
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@rudiedirkx
rudiedirkx / filesearch.php
Last active July 10, 2021 18:19
Search for/in (certain) files
<?php
class Filesearch {
// Config
public $string = '';
public $extensions = array();
public $dir = '';
public $exclude = array();
public $in_files = true;
public $matcher = 'ci';