This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
N = 10_000_000 | |
def foo(a: 1) | |
a | |
end | |
10.times do | |
p Benchmark.realtime { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'ffi' | |
class S < FFI::Struct | |
layout :next, :pointer | |
end | |
p S.new[:next] # <Pointer address=0x0> | |
if defined?(Rubinius) | |
p Rubinius |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require 'benchmark' | |
dir = "data" | |
Dir.mkdir(dir) unless Dir.exist?(dir) | |
input = "#{dir}/extract.csv" | |
unless File.exist?(input) | |
Dir.chdir(dir) do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i = ARGF.read | |
s=[] | |
S=/"(?:\\["\\\/bfnrtu]|[^"\\])*"/ | |
while i[S];s<<$`<<$&;i=$';end | |
s<<i | |
I=s.each{|e|e.gsub!(/\s+/,'')if e[0]!=?"}.join | |
G=/ | |
(?<obj>\{(?:\g<pair>(?:,\g<pair>)*)?\}){0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef EXTCONF_H | |
#define EXTCONF_H | |
#define HAVE_OPENSSL_SSL_H 1 | |
#define HAVE_SSLV3_METHOD 1 | |
#define HAVE_TLSV1_1_METHOD 1 | |
#define HAVE_TLSV1_2_METHOD 1 | |
#define HAVE_ENGINE_LOAD_BUILTIN_ENGINES 1 | |
#define HAVE_ENGINE_LOAD_DYNAMIC 1 | |
#define HAVE_ENGINE_LOAD_CRYPTODEV 1 | |
#define HAVE_EVP_CIPHER_CTX_NEW 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/time.h> | |
#include <sys/types.h> | |
#include <sys/resource.h> | |
#include <sys/wait.h> | |
#include <spawn.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <unistd.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark/ips' | |
class Array | |
def to_proc | |
if self[0].is_a? Symbol | |
method, *arguments = self | |
-> receiver { receiver.send method, *arguments } | |
elsif self[1].is_a? Symbol | |
receiver, method, *arguments = self | |
-> argument { receiver.send method, argument } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
import java.util.concurrent.ConcurrentHashMap; | |
import java.util.function.Function; | |
public class Main { | |
public static final Map<String, Integer> MAP = new ConcurrentHashMap<>(); | |
public static void main(String[] args) { | |
int n = Integer.parseInt(args[args.length - 1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NP = 5 | |
ROW = 8 + NP | |
COL = 8 | |
$p = [] | |
$b = [] | |
$no = 0 | |
def piece(n, a, nb) | |
nb.each{|x| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <signal.h> | |
#include <string.h> | |
#include <errno.h> | |
void on_signal(int sig) { | |
printf("\nIN handler\n"); | |
//nothing | |
} |