Skip to content

Instantly share code, notes, and snippets.

View syrnick's full-sized avatar

Alexander Sorokin syrnick

View GitHub Profile
@syrnick
syrnick / lambda.js
Created May 11, 2018 00:15
Test timers lambda
var lastRun = new Date();
var numFailed = 0;
var numUpdatedTime = 0;
var numChecked = 0;
var numFatalFailures = 0;
setInterval(() => {
numUpdatedTime++;
console.log('---------- Update time', new Date().toJSON());
lastRun = new Date();
<--- Last few GCs --->
15171 ms: Scavenge 943.8 (979.8) -> 935.9 (979.8) MB, 0.2 / 0 ms [allocation failure].
15269 ms: Mark-sweep 940.1 (980.8) -> 583.1 (624.8) MB, 92.8 / 0 ms [allocation failure] [GC in old space requested].
15342 ms: Mark-sweep 583.1 (624.8) -> 583.1 (621.8) MB, 72.2 / 0 ms [allocation failure] [GC in old space requested].
15406 ms: Mark-sweep 583.1 (621.8) -> 583.1 (621.8) MB, 64.2 / 0 ms [last resort gc].
15469 ms: Mark-sweep 583.1 (621.8) -> 583.0 (621.8) MB, 63.2 / 0 ms [last resort gc].
<--- JS stacktrace --->
// @flow
declare function SomeFn(): void;
type A = {
type: 'simple';
foo: number;
requiredName: string;
};
#!/usr/bin/env python
"""
(C) Alexander Sorokin, 2009
License: BSD
"""
import os,sys, getopt
#This is the default BIN location. You don't need to change it.
#You should use --ag_bin= command line argument to override it.
@syrnick
syrnick / taxonomy_exercise.markdown
Created November 10, 2011 18:57 — forked from tysonmote/client_services.markdown
Taxonomy Code Exercise

Taxonomy Code Exercise

Using HTML, CSS, and JavaScript, you will create a tool that allows a user to drill down through a tree of categories and select a final category. The taxonomy data is represented as a tree of categories. A category can have any number of children. A category with no children is considered a selectable category (categories with children should not be selectable).

The taxonomy data is located at https://gist.github.com/935805

Thread.abort_on_exception = true
Thread.new {
sleep(1)
$stderr.puts ">> Baby threw up."
raise "Barf."
}
$stderr.puts ">> Mommy is listening to the monitor, but she is also drunk."
sleep(5)
@syrnick
syrnick / dm_to_json_spec.rb
Created January 13, 2011 00:45
To json issues
# Example of our problems with to_json( :to_json => false )
require 'rubygems'
require 'dm-core'
require 'dm-migrations'
require 'dm-migrations/migration_runner'
require 'dm-timestamps'
require 'dm-serializer'
require 'dm-types'
@syrnick
syrnick / dm_performance_test2.rb
Created January 5, 2011 23:55
Datamapper performance comparison and profiling. Part2.
# Trying to replicate performance issues with DM 1.0
# DM 1.02:
# Create: 3.100000 0.180000 3.280000 ( 4.758490)
# Get: 3.720000 0.180000 3.900000 ( 5.238979)
# DM 0.10:
# Create: 1.200000 0.100000 1.300000 ( 2.411933)
# Get: 2.540000 0.130000 2.670000 ( 3.465188)
###
require 'rubygems'
# Trying to replicate performance issues with DM 1.0
# DM 0.10.2 -> 1.230000 0.110000 1.340000 ( 2.535200)
# DM 1.0.2 -> 3.080000 0.190000 3.270000 ( 4.842546)
#
require 'rubygems'
require 'dm-core'
require 'dm-migrations'
require 'dm-migrations/migration_runner'
require 'dm-timestamps'
require 'benchmark'
@syrnick
syrnick / DM 0.10 run
Created October 15, 2010 21:40
Performance comparison between DM 1.0.2 and 0.10.0
Performance for lazy_load
Instantiate 100 times: 0.000000 0.000000 0.000000 ( 0.000336)
Save 100 times: 0.160000 0.010000 0.170000 ( 0.189396)
Get 100 times: 0.080000 0.000000 0.080000 ( 0.094426)
Get Text 100 times: 0.160000 0.010000 0.170000 ( 0.201173)
- should be great
Performance for json
Instantiate 100 times: 0.000000 0.000000 0.000000 ( 0.000350)
Save 100 times: 0.050000 0.010000 0.060000 ( 0.073780)