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
  • 17:20 (UTC +05:00)
View GitHub Profile
@SammyK
SammyK / php-retry-keyword.md
Last active April 3, 2018 05:47
Possible syntax for adding the `retry` keyword to PHP 7.next

Without retry keyword

try {
	$attempts = 0;
	retry:
	throw new Exception('Oops!');
} catch (Exception $e) {
	if ($attempts < 4) {
		$attempts++;
@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
@randym
randym / date_styles.rb
Created September 14, 2012 02:12
Axlsx date formatting with custom styles
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
require 'axlsx'
require 'date'
p = Axlsx::Package.new
wb = p.workbook
wb.styles do |style|
# Date/Time Styles
#
@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
# Written by Aaron Cohen -- 1/14/2013
# Brought to you by BitTorrent, Inc.
# "We're not just two guys in a basement in Sweden." TM
#
# This work is licensed under a Creative Commons Attribution 3.0 Unported License.
# See: http://creativecommons.org/licenses/by/3.0/
import sys
import re
import socket
@Nurmukhamed
Nurmukhamed / w_bareos.ks
Last active March 10, 2022 10:22
How to setup Documentolog on Centos 7, very hardened, russian language

Введение

Обновление от 18 октября 2018

Исправлена ошибка в documentolog.ks

Заменены пакеты php на php54 от remi, изменен kickstart файл

Обнаружился новый компонент Apache Solr, создан отдельный kickstart файл

@Yelakelly
Yelakelly / sql.sql
Created January 2, 2018 12:53
MySQL - cyrillic to latin (MySQL)
DELIMITER $$
--
-- Functions
--
CREATE FUNCTION `transliterate_func`(original VARCHAR(512)) RETURNS varchar(512) CHARSET utf8
BEGIN
DECLARE translit VARCHAR(512) DEFAULT '';
DECLARE len INT(3) DEFAULT 0;
DECLARE pos INT(3) DEFAULT 1;
@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
@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 -
'''
@bradland
bradland / data_validations.rb
Last active November 11, 2022 17:01
Data validations with axlsx gem
#!/usr/bin/env ruby -w -s
# -*- coding: utf-8 -*-
require 'axlsx'
## Some documentation ##
### Axlsx Gem ###
# Axlsx Docs: http://rubydoc.info/gems/axlsx/frames
# Axlsx::DataValidation: http://rubydoc.info/gems/axlsx/Axlsx/DataValidation