Skip to content

Instantly share code, notes, and snippets.

Sokolov Yura funny-falcon

Block or report user

Report or block funny-falcon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@funny-falcon
funny-falcon / mypassw.rb
Last active Nov 18, 2019
Personal password storage :)
View mypassw.rb
#!/usr/bin/env ruby
require 'digest/sha2'
require 'io/console'
require 'base64'
USAGE = <<EOF
USAGE:
#$0 set domain [file]
- store encoded password for domain
#$0 domain [file]
@funny-falcon
funny-falcon / patch-1.9.2-gc.patch
Created Mar 5, 2011
GC tunning simple patch ruby 1.9.2 p180
View patch-1.9.2-gc.patch
diff --git a/gc.c b/gc.c
--- a/gc.c
+++ b/gc.c
@@ -77,6 +77,41 @@ void *alloca ();
#ifndef GC_MALLOC_LIMIT
#define GC_MALLOC_LIMIT 8000000
#endif
+#define HEAP_MIN_SLOTS 10000
+#define FREE_MIN 4096
+
View greeter_client.go
/*
*
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
View maglev.go
package main
const TableSize = uint16(1 << 14)
type Table []uint16
type Shard struct {
Hash uint64
Weight float64
}
@funny-falcon
funny-falcon / java.java
Created Aug 13, 2012
Consistent hash from Google Guava Core libraries
View java.java
/**
* Assigns to {@code input} a "bucket" in the range {@code [0, buckets)}, in a uniform
* manner that minimizes the need for remapping as {@code buckets} grows. That is,
* {@code consistentHash(h, n)} equals:
*
* <ul>
* <li>{@code n - 1}, with approximate probability {@code 1/n}
* <li>{@code consistentHash(h, n - 1)}, otherwise (probability {@code 1 - 1/n})
* </ul>
*
@funny-falcon
funny-falcon / changes.md
Last active Jan 18, 2018
Performace patch for ruby-1.9.3-p327
View changes.md

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.

View promiseme.js
let handlers = {}
handlers.get = function(target, property) {
let v = target[property]
if (typeof(v) == "function") {
return async (...args) => {
return new Promise((resolve, reject) => {
target[property](...args, (err, ...rest) => {
if (err) reject(err)
else resolve(rest.length == 1 ? rest[0] : rest)
View hashtbl.cr
class HashChTbl(K, V)
include Enumerable({K, V})
include Iterable({K, V})
getter size : Int32 = 0
# index into SIZES array
@sz : UInt8 = 0_u8
@rebuild_num : UInt16 = 0_u16
@first : UInt32 = 0_u32
@last : UInt32 = 0_u32
View .gitconfig
[gui]
spellingdictionary = en_US
tabsize = 4
fontui = -family \"DejaVu Sans\" -size 10 -weight normal -slant roman -underline 0 -overstrike 0
fontdiff = -family \"DejaVu Sans Mono\" -size 10 -weight normal -slant roman -underline 0 -overstrike 0
[user]
emal = funny.falcon@gmail.com
email = funny.falcon@gmail.com
name = Sokolov Yura
[http]
@funny-falcon
funny-falcon / cumulative_performance.patch
Created Jan 22, 2012
ruby-1.9.3-p0 cumulative performance patch.
View cumulative_performance.patch
diff --git a/common.mk b/common.mk
index ea244cc..4f22609 100644
--- a/common.mk
+++ b/common.mk
@@ -629,7 +629,8 @@ file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
{$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
- {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h
+ {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h \
You can’t perform that action at this time.