Skip to content

Instantly share code, notes, and snippets.

source 'https://rubygems.org'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
@stakach
stakach / gist:5204063
Created March 20, 2013 11:47
Celluloid Actors vs Actor Pools - Fibres vs Threads
require 'celluloid'
require 'benchmark'
$mutex = Mutex.new
$resource = ConditionVariable.new
class Example
include Celluloid
def slow_method
@stakach
stakach / gist:5204160
Created March 20, 2013 12:07
Fiber vs Thread using futures
require 'celluloid'
require 'benchmark'
class Example
include Celluloid
def slow_method
sleep 5
end
@stakach
stakach / gist:5335327
Created April 8, 2013 08:57
AngularJS Mobile + Desktop Events
(function(angular, undefined) {
'use strict';
angular.module('Core.SafeApply', []).
service('Core.SafeApply', function() {
this.do = function(scope, fn) {
var phase = scope.$root.$$phase;
if(phase == '$apply' || phase == '$digest') {
fn();
@stakach
stakach / dtls_api.md
Created January 5, 2017 06:49 — forked from Jxck/dtls_api.md
OpenSSL DTLS API

OpenSSL DTLS API

The API used for DTLS is mostly the same as for TLS, because of the mapping of generic functions to protocol specifc ones. Some additional functions are still necessary, because of the new BIO objects and the timer handling for handshake messages. The generic concept of the API is described in the following sections. Examples of applications using DTLS are available at [9].

DTLS の API は TLS とほぼ同じ。 BIO オブジェクトの生成とタイマのために追加でいくつか必要。

@stakach
stakach / $namedRoute.js
Last active May 13, 2018 08:12
Augments AngularJS $route provider with route naming.
(function(angular) {
'use strict';
/*
Usage:
-----
FILE --app.js--
@stakach
stakach / manager.rb
Created May 30, 2018 02:35
SNMP Manager
# frozen_string_literal: true
require 'netsnmp'
require 'logger'
module NETSNMP
# Provides a base class for building SNMP Managers
#
# Does not implement a transport so must be subclassed
@stakach
stakach / google_auth.cr
Created August 7, 2019 08:08
Crystal Lang Google Calendar
require "jwt"
require "json"
require "http"
require "uri"
require "./http_proxy"
class GoogleAuth
GOOGLE_URI = URI.parse("https://www.googleapis.com")
TOKEN_PATH = "/oauth2/v4/token"
Invalid memory access (signal 11) at address 0x0
[0x564255739966] *Exception::CallStack::print_backtrace:Nil +118 in /home/steve/projects/client-projects/crystal/.build/crystal
[0x56425570fab6] ~procProc(Int32, Pointer(LibC::SiginfoT), Pointer(Void), Nil) +310 in /home/steve/projects/client-projects/crystal/.build/crystal
[0x7f159c1ff140] ?? +139730790379840 in /lib/x86_64-linux-gnu/libpthread.so.0
[0x7f159d2b57f3] _ZN4llvm11PointerType3getEPNS_4TypeEj +19 in /lib/x86_64-linux-gnu/libLLVM-11.so.1
[0x7f159d1bd090] ?? +139730806886544 in /lib/x86_64-linux-gnu/libLLVM-11.so.1
[0x7f159d1de412] ?? +139730807022610 in /lib/x86_64-linux-gnu/libLLVM-11.so.1
[0x7f159d1ed685] ?? +139730807084677 in /lib/x86_64-linux-gnu/libLLVM-11.so.1
[0x7f159d1ed5dd] LLVMBuildInBoundsGEP +77 in /lib/x86_64-linux-gnu/libLLVM-11.so.1
[0x56425681a36f] *LLVM::Builder#inbounds_gep<LLVM::Value, LLVM::Value, LLVM::Value, String>:LLVM::Value +175 in /home/steve/projects/client-projects/crystal/.build/crystal