Skip to content

Instantly share code, notes, and snippets.

View NormanEdance's full-sized avatar
💭
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.
  • Astana, Kazakhstan
  • 04:05 (UTC +05:00)
View GitHub Profile
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@tmilos
tmilos / README.md
Last active March 18, 2024 05:34
Modified Preorder Tree Traversal

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

@carlaizumibamford
carlaizumibamford / How to change the default charset to UTF-8 on XAMMP (MySQL)
Created November 10, 2014 21:06
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
@ryansobol
ryansobol / symbols.md
Last active May 27, 2022 17:34
Symbols in Ruby

What's a Symbol and why is it imporant?

In Ruby, a Symbol is the most efficient way, in terms of time and memory, to represent a set of characters.

What does a Symbol look like?

Most commonly, a Symbol is a single word prefixed by a colon:

:hello
@DavidRockin
DavidRockin / Mailer.php
Created August 2, 2014 21:53
PHPMailer save emails to IMAP folder
<?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 July 14, 2014 04:50
Script for live video streaming monitoring with notifications
#!/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 April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active April 18, 2024 16:07
how to delete a git tag locally and remote
# 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
@cuadue
cuadue / cubism-websockets.html
Created September 3, 2013 17:43
Streaming data to cubism.js with websockets
<!DOCTYPE html>
<meta charset='utf-8'>
<head>
<title>Cubism + Websockets</title>
<script language='javascript' src='d3.min.js'></script>
<script language='javascript' src='cubism.v1.js'></script>
<script language='javascript'>
/* I can never seem to remember:
Array.push() appends to the end, and returns the new length