Skip to content

Instantly share code, notes, and snippets.

View romshark's full-sized avatar
👨‍💻
Today's game: build an expr. parser in Go: https://play.golang.org/p/QyiDCAQPcSm

Roman Sharkov romshark

👨‍💻
Today's game: build an expr. parser in Go: https://play.golang.org/p/QyiDCAQPcSm
  • tutti.ch | Swiss Marketplace Group
  • Switzerland
  • X @romshar
View GitHub Profile
var libasync = require('async')
function asyncCount(max, delay) {
return new Promise(function(resolve, reject) {
var counter = 1
libasync.doWhilst(
//iteration
function(evaluate) {
console.log('iteration:', counter)
++counter
/users/
READ: returns a list of user ids
CREATE: creates a new user
Permissions:
Owner: -
Group("users"): read
Group("administrative"): read, create
Others: create
@romshark
romshark / compiler
Last active March 9, 2016 14:17
Automatically reloads page remembering scroll position
#!/bin/bash
DIR="./"
while true; do
echo "listen on $DIR"
FILE=$(inotifywait -rqe modify $DIR)
echo -e "\t$FILE - compile..."
sassc styles/main.sass ./main.css -t compressed
echo -e "\tcompiled!"
done
# -*- mode: ruby -*-
# vim: ft=ruby
# ---- Configuration variables ----
GUI = false # Enable/Disable GUI
RAM = 512 # Default memory size in MB
# Network configuration
<?php
class ConfigModel{
protected $conf = array();
protected $changed = array();
public function __construct(array $conf) {
$this->conf = $conf;
}
@romshark
romshark / config.js
Last active July 9, 2016 21:35
LevelDB benchmarking in Node.js
module.exports = {
minValueLength: 128,
maxValueLength: 128,
valueCharSet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',
testDatabaseName: 'testdb',
keyPrefix: 'key_',
itemCount: 1000000
}
@romshark
romshark / aes_ctr_testsuite
Last active October 22, 2016 16:42
AES CTR Testsuite for encryption and decryption performance benchmarking
package main
import (
"crypto/aes"
"crypto/cipher"
cryptorand "crypto/rand"
"flag"
"fmt"
"io"
"math/rand"
@romshark
romshark / Async IPC Server
Last active January 25, 2017 10:31
This is an asynchronous IPC server test suite written in Go. It uses nanomsg for the transport layer, depends on the go-nanomsg Go-binding (https://github.com/op/go-nanomsg) and requires libnanomsg to be installed.
package main
import (
"fmt"
"sync"
"time"
"bytes"
nanomsg "github.com/op/go-nanomsg"
)

Keybase proof

I hereby claim:

  • I am romshark on github.
  • I am romshark (https://keybase.io/romshark) on keybase.
  • I have a public key ASBNhDYIok7LhZ2VQgkl7C9xxzBr5y2_NsFpcyG_KiMMJAo

To claim this, I am signing this object:

@romshark
romshark / upload_file.js
Last active May 10, 2017 18:27
Asynchronous Transactional API
// copyright (C) 2017 Roman Sharkov
//
// this function uploads a localy stored file identified by the given path.
// it returns a cancelable transaction that guarantees "all or nothing".
//
// Error Codes:
// 1 = file could not have been created
// 2 = upload failed expectedly, it was manually removed during the uploading
// 3 = upload failed for unexpected reason
function uploadFile(path, newName) {