Skip to content

Instantly share code, notes, and snippets.

💭
Life cannot just be about solving one sad problem after another.

Norman E. NormanEdance

💭
Life cannot just be about solving one sad problem after another.
Block or report user

Report or block NormanEdance

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DGrady
DGrady / subprocess_filter.py
Last active Feb 12, 2018
Stream data asynchronously through a subprocess in Python
View subprocess_filter.py
"""
Problem: provide two-way communication with a subprocess in Python.
See also:
- https://kevinmccarthy.org/2016/07/25/streaming-subprocess-stdin-and-stdout-with-asyncio-in-python/
- http://eli.thegreenplace.net/2017/interacting-with-a-long-running-child-process-in-python/
"""
import asyncio
import sys
@SammyK
SammyK / php-retry-keyword.md
Last active Apr 3, 2018
Possible syntax for adding the `retry` keyword to PHP 7.next
View php-retry-keyword.md

Without retry keyword

try {
	$attempts = 0;
	retry:
	throw new Exception('Oops!');
} catch (Exception $e) {
	if ($attempts < 4) {
		$attempts++;
@nvgoldin
nvgoldin / asyncio_shutdown_loop.py
Created Jul 27, 2016
Python 3.5 asyncio - shutdown all tasks safely using signal handler
View asyncio_shutdown_loop.py
import signal
import functools
async def looping_task(loop, task_num):
try:
while True:
print('{0}:in looping_task'.format(task_num))
await asyncio.sleep(5.0, loop=loop)
except asyncio.CancelledError:
return "{0}: I was cancelled!".format(task_num)
@tmilos
tmilos / README.md
Last active Dec 8, 2019
Modified Preorder Tree Traversal
View README.md

Modified Preorder Tree Traversal

Hierarchical data metrics that allows fast read operations on tree like structures.

Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.

Sample implementation

@carlaibamford
carlaibamford / How to change the default charset to UTF-8 on XAMMP (MySQL)
Created Nov 10, 2014
How to change the default charset to UTF-8 on XAMMP (MySQL)
View How to change the default charset to UTF-8 on XAMMP (MySQL)
1. Open "my.ini" in "C:\xampp\mysql\bin\" directory.
2. Edit the following lines.
# Add the following code before [client].
default-character-set=utf8
# Add the following code before [mysqld].
character-set-server=utf8
skip-character-set-client-handshake
@DavidRockin
DavidRockin / Mailer.php
Created Aug 2, 2014
PHPMailer save emails to IMAP folder
View Mailer.php
<?php
class Mailer extends PHPMailer {
/**
* Save email to a folder (via IMAP)
*
* This function will open an IMAP stream using the email
* credentials previously specified, and will save the email
* to a specified folder. Parameter is the folder name (ie, Sent)
@sinkers
sinkers / livestreammonitor.py
Created Jul 14, 2014
Script for live video streaming monitoring with notifications
View livestreammonitor.py
#!/usr/bin/python
'''
Script to monitor live streams and send an Amazon SNS if the stream is down (and possibly take restorative action)
Future:
Black detect: ffmpeg -i out.mp4 -vf blackdetect -f null -
Note the following doesn't seem to fully work without looking at the debug logs
On live ffmpeg -y -i rtmp://cp30129.live.edgefcs.net/live/videoops-videoops@50541 -vf blackdetect -t 10 -loglevel debug -f null -
'''
@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created Apr 17, 2014
Git force pull to overwrite local files
View gist:10964772
git fetch --all
git reset --hard origin/master
git pull origin master
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active Dec 11, 2019
how to delete a git tag locally and remote
View git-tag-delete-local-and-remote.sh
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
You can’t perform that action at this time.