Skip to content

Instantly share code, notes, and snippets.

View abstractart's full-sized avatar
👷‍♂️
Work

Eugene Kozlov abstractart

👷‍♂️
Work
  • Saint Petersburg, Russia
  • 15:42 (UTC +03:00)
View GitHub Profile
@abstractart
abstractart / books.md
Last active April 13, 2024 00:01
Free Programming Ebooks - O'Reilly Media. Codeship free ebooks here - https://bit.ly/2oQ0knQ
@abstractart
abstractart / main_resources_ierarchy.go
Last active January 29, 2022 20:08
Dining philosopher problem solutions written in Go/Golang
package main
import (
"fmt"
"sync"
"time"
)
func main() {
count := 5
@abstractart
abstractart / main.go
Created November 10, 2021 09:31
BigIntegers Serialization and Deserialization in Golang
package main
import (
"bytes"
"encoding/json"
"fmt"
)
func main() {
jsonStr := "{\"time\":9223372036854775807}\n"
@abstractart
abstractart / fibonacci_with_fibers.rb
Created July 5, 2021 14:52
A implementation of Fibonacci function using Ruby Fibers
fib = Fiber.new do
last = [0, 1]
while(true)
v = last.sum
last[0] = last[1]
last[1] = v
Fiber.yield v
end
from random import randint
from time import sleep
from copy import deepcopy
import os
LIFE = 1
DEATH = 0
def main():
cols, rows = 7, 7
@abstractart
abstractart / script.rb
Last active June 10, 2020 09:44
Constructor with block in Ruby
class A
attr_accessor :attribute
def initialize
yield self
end
end
a = A.new {|a| a.attribute = "block" }.tap {|a| puts a.attribute }
@abstractart
abstractart / .ssh.config
Created April 28, 2019 15:03
SSH connection through shadowsocks
# ~/.ssh/config
Host 159.89.190.250 # DigitalOcean droplet ip
ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p # 127.0.0.1:1080 - shadowsocks
@abstractart
abstractart / script.rb
Created November 6, 2018 09:45
Downcase non-ASCII characters in Ruby < 2.4
# gem install activesupport
require 'active_support/core_ext/string/multibyte'
"Женя".mb_chars.downcase.to_s # => "женя"
"Женя".mb_chars.upcase.to_s # => "ЖЕНЯ"