Skip to content

Instantly share code, notes, and snippets.

View Aeon's full-sized avatar
🦴

Anton Stroganov Aeon

🦴
View GitHub Profile
@Aeon
Aeon / logserver.rb
Last active August 29, 2015 14:27
minimal logserver
require 'sinatra'
logfile = 'log.json'
get '/' do
send_file logfile, :type => :text
end
post '/' do
File.open(logfile, 'a') do |filehandle|
@Aeon
Aeon / gulpfile.js
Created June 3, 2015 19:19
gulp + browserify...
/*
* gulp and site config based on
* http://justinjohnson.org/javascript/getting-started-with-gulp-and-browserify/
* https://gist.github.com/Sigmus/9253068
*
*/
try {
var gulp = require('gulp'),
@Aeon
Aeon / _.md
Created February 4, 2015 01:34
d3 box plot
var page = new WebPage(),
address, selector, filename;
var system = require('system');
page.onConsoleMessage = function(msg) {
system.stderr.writeLine('console: ' + msg);
};
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clips) {
#!/usr/bin/env ruby
require 'resque'
Resque.redis.namespace = "resque:#{ENV['APP_NAME']}"
while Resque::Failure.count > 0 do |i|
job = Resque::Failure.all(0,1)
unless !job || job['retried_at'].nil?
Resque::Failure.remove(0)
else
break
@Aeon
Aeon / mtool.rb
Last active August 29, 2015 13:57
require 'api/pools.rb'
module Mtool
extend Blather::DSL
#Blather.logger.level = Logger::DEBUG
Blather.logger.level = Logger::INFO
@@faye = nil
@Aeon
Aeon / adapters-application.js
Last active March 21, 2016 18:50
faye adapter for ember-data
require('config/adapters/faye-adapter');
export default DS.FayeAdapter.extend();
git log --author="`git config user.name`" --shortstat --since=yesterday | egrep 'files? changed' | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "", files, "files changed,", inserted, "insertions(+),", deleted, "deletions(-)"}'
@Aeon
Aeon / gist:5110246
Last active December 14, 2015 15:48
moving files - there and back again
if you have a list of files that you had to temporarily move
out of a nested subdirectory set into a single directory, you
can move them back correctly by doing this on the list of
original locations
search and replace
^(.*?)?([^/\n]*/?)$
with
mv "$2" "/origin/$0"
@Aeon
Aeon / blabla.md
Last active December 14, 2015 07:59
forking and db resources and postgres

anyway what happens is

  • parent opens db connection $db
  • parent forks child worker, which inherits the connection resource
  • child worker does some work and exits (successfully or not)
  • php cleans up any open resource handles, $db among them.
  • parent thinks $db is still a valid resource.
  • parent tries to access it, or parent forks a new child and gives it the invalid handle...
  • php goes boom, because it tries to use an invalid connection resource.