Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View clue's full-sized avatar

Christian Lück clue

View GitHub Profile
#!/bin/sh
branch=$(git branch 2>/dev/null | grep ^\*)
[ x$1 != x ] && tracking=$1 || tracking=${branch/* /}
git config branch.$tracking.remote origin
git config branch.$tracking.merge refs/heads/$tracking
echo "tracking origin/$tracking"
@jsor
jsor / Connection.php
Last active April 27, 2018 07:12
Async MySQL Client
<?php
namespace Jsor\MysqlAsync;
use React\EventLoop\LoopInterface;
use React\Promise\Deferred;
class Connection
{
private $loop;
@jjsaunier
jjsaunier / Dockerfile
Last active August 14, 2018 18:56
PPM under PHAR
FROM php-cgi #custom
COPY api.phar /api.phar
EXPOSE 8888
CMD ["/api.phar", "start", "-c", "ppm.json"]
@igorw
igorw / gist:4475804
Last active October 4, 2019 15:32
Composer Versioning
@padraic
padraic / checksslcontext.php
Last active October 29, 2020 01:10
Correct SSL/TLS Context Settings for file_get_contents() and other PHP stream calls under PHP 5.5 (or earlier)
<?php
ini_set('display_errors', 1);
/**
* This script check how PHP makes HTTPS (SSL/TLS) requests using PHP Streams
* or cURL. Configuration options are passed as GET parameters, for example:
* http://localhost/checksslcontext.php?reconfigure=1
*
* Configuration:
* http://localhost/checksslcontext.php
* Basic PHP Streams using file_get_contents(). Default settings.
@mathiasverraes
mathiasverraes / TestFrameworkInATweet.php
Last active May 23, 2022 12:28
A unit testing framework in a tweet.
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
@Blackshawk
Blackshawk / blog - Explaining My Choices Further.md
Last active April 25, 2023 19:31
In which I do a little digging about the choices I've made with PHP. This is a long read, but it isn't something that can be explained in one or two paragraphs.

In the comments from my last post and on Twitter I noticed a lot of people who had something to say about PHP. The comments were varied but they usally sounded something like this (sorry @ipetepete, I picked yours because it was the shortest).

...the little bits of soul from all of us who've had to work on, and or maintain large PHP applications. – ipetepete

In Pete's defense, he did go on to say that rest of the stack I was using was a "smorgasbord of awesome". Thanks, Pete. I agree!

I would, however, like to take a little time to correct a misperception in the developer community about PHP. I recently got into this same... discussion... with Jeff Atwood, and I seem to be running into it more and more. So here goes. Please bear with me as I cover a little history further on.

Pete, and everybody else, _you're exactly rig

@krakjoe
krakjoe / pthreads.md
Last active August 30, 2023 18:30
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
@miohtama
miohtama / purge_logs.sh
Created January 27, 2017 10:04
Remove old logs from Quassel SQLite database
#!/bin/sh
BAK_PATH="${HOME}/.config/quassel-irc.org/quassel-storage.sqlite.bak"
CURRENT_PATH="${HOME}/.config/quassel-irc.org/quassel-storage.sqlite"
# first day of data that will be maintained
# -15 day means that *every* chatline stored before 16 days ago and so on are going to be eliminated.
# only the last 15 days are keeped.
DATE_TO_PRUNE='-15 day'
die() {