This file contains hidden or 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 <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#define MAX_STRING 100001 | |
static char s[MAX_STRING] ; | |
static unsigned sl ; |
This file contains hidden or 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> | |
#ifndef NBITS | |
#define NBITS 42 | |
#endif | |
static unsigned long long states[NBITS + 1][7][2 * NBITS] ; | |
/* step s r */ | |
static inline int next_s(int s, int b) { |
This file contains hidden or 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 <stdlib.h> | |
#define N 26 | |
#define LEN (N * 2 + 1) | |
static int s[LEN] ; | |
static void print_s(void) { | |
for (int i = 0; i < LEN; i ++) |
This file contains hidden or 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
#! /usr/bin/env ruby | |
require 'uri' | |
require 'net/http' | |
require 'json' | |
class Mukom < Net::HTTP | |
BASE = URI.parse 'https://mokum.place/api/v1/' | |
attr_accessor :api_key |
This file contains hidden or 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
# compile with --release, connect with netcat: nc localhost 12300, try multiple times | |
require "socket" | |
TCPServer.new(12300, reuse_port: true).accept.puts "hi" |
This file contains hidden or 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 "http/server" | |
handler = HTTP::WebSocketHandler.new do |session| | |
session.on_message do |message| | |
puts "Received #{message}" | |
pp [email protected] message | |
end | |
end | |
HTTP::Server.new(8081, [handler, HTTP::LogHandler.new]).listen |
This file contains hidden or 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
def check(l) | |
abba = false | |
l.scan(/([a-z])([a-z])\2\1/) do |rm| | |
next if $1 == $2 | |
return false if rm.pre_match =~ /\[[^\]]*$/ | |
abba = true | |
end | |
!!abba | |
end |
This file contains hidden or 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
jason@jsn cr $ head -n 1000 z.cr z2.cr | |
==> z.cr <== | |
class Z | |
def self.f | |
puts "in class method" | |
return Time.now | |
end | |
@@x : Time = f() |
This file contains hidden or 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
jason@jsn cr $ crystal z2.cr | |
in class method for x | |
2018-02-09 03:17:03 +03:00 | |
before | |
in class method for y | |
in class | |
out of class | |
after | |
jason@jsn cr $ head -n 1000 z.cr z2.cr | |
==> z.cr <== |
This file contains hidden or 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
jason@jsn cr $ head -n1000 z.cr z2.cr | |
==> z.cr <== | |
def q | |
puts "in q" | |
1 | |
end | |
Q = q() | |
class Z |