Skip to content

Instantly share code, notes, and snippets.

View siman's full-sized avatar
🏠
Working from home

Alex Siman siman

🏠
Working from home
View GitHub Profile
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active December 1, 2023 04:55
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
@retronym
retronym / type-bounds.scala
Created December 16, 2009 11:17
Tour of Scala Type Bounds
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
@siman
siman / Web3-Foundation-tasks-for-blockchain-hackathon-Kyiv-Sep-2019.md
Created September 17, 2019 08:25
Web3 Foundation tasks for blockchain hackathon. Kyiv, Sep 21-22, 2019.

Вознаграждение от Web3 Foundation в размере $500 получит команд(а/ы), которая предложит качественное решение на блокчейне фреймворке Substrate или же, если это решение связано с инфраструктурой Polkadot Network. В качестве примеров, могут быть проекты на такую тему:

  • Альтернативные реализации тех модулей (SRML), которые уже идут в составе Substrate. Например:
    • Упрощенный модуль для балансов "balances" без locking, vesting, etc.
    • Упрощенный модуль для голосования "voting" с квадратическим голосованием.
    • Альтернативная реализация модуля "treasury"
    • и т.д.
@siman
siman / visual-code-user-settings.json
Last active June 30, 2019 09:49
Visual Studio Code with Rust syntax. You need to install "dark-plus-syntax" theme before.
{
"window.zoomLevel": 1,
"gitlens.settings.mode": "advanced",
"eslint.enable": false,
"files.autoSave": "onFocusChange",
"files.associations": {
"*.css": "scss"
},
"editor.wordWrap": "on",
"editor.renderWhitespace": "boundary",
@abrkn
abrkn / index.js
Created October 13, 2017 20:53
kraken-minimal-trader
#!/usr/bin/env node
const assert = require('assert');
const { delay } = require('bluebird');
const BigNumber = require('bignumber.js');
const kraken = require('./kraken');
const {
fetchMyOpenOrders,
fetchOrderBook,
placeOrder,
@bithavoc
bithavoc / postgres-notify-trigger.sql
Last active February 2, 2019 09:31
I used this trigger to notify table changes via NOTIFY (migrating off RethinkDB)
CREATE OR REPLACE FUNCTION notify_trigger() RETURNS trigger AS $$
DECLARE
channel_name varchar DEFAULT (TG_TABLE_NAME || '_changes');
BEGIN
IF TG_OP = 'INSERT' THEN
PERFORM pg_notify(channel_name, '{"id": "' || NEW.id || '"}');
RETURN NEW;
END IF;
IF TG_OP = 'DELETE' THEN
PERFORM pg_notify(channel_name, '{"id": "' || OLD.id || '"}');
@siman
siman / image-proxy.conf
Created September 24, 2018 21:08 — forked from tmaiaroto/image-proxy.conf
Nginx Image Filter Resize Proxy Service
# Feel free to change this path of course (and keys_zone value as well, but also change the usage of it below).
proxy_cache_path /var/www/cache/resized levels=1:2 keys_zone=resizedimages:10m max_size=1G;
# Gzip was on in another conf file of mine...You may need to uncomment the next line.
#gzip on;
gzip_disable msie6;
gzip_static on;
gzip_comp_level 4;
gzip_proxied any;
# Again, be careful that you aren't overwriting some other setting from another config's http {} section.
@siman
siman / jquery-in-browser-console.js
Created April 20, 2017 23:59
Inject jQuery into browser console
var script = document.createElement("script");
script.setAttribute("src", "//code.jquery.com/jquery-latest.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
@guersam
guersam / AutoProductFormat.scala
Last active March 8, 2017 19:26
Macro-based json format generator for spray-json (https://github.com/spray/spray-json)
package spray.json
import scala.language.experimental.macros
trait AutoProductFormat extends DefaultJsonProtocol {
implicit def jsonFormat[T <: Product]: RootJsonFormat[T] = macro AutoProductFormatMacro.autoProductFormatMacro[T]
}
object AutoProductFormat extends AutoProductFormat
@m242
m242 / gist:1205631
Created September 9, 2011 06:43
Scala Option in JavaScript
var MyOption, Option;
Array.prototype.filter = function(f) {
var x, _i, _len, _results;
_results = [];
for (_i = 0, _len = this.length; _i < _len; _i++) {
x = this[_i];
if (f(x)) {
_results.push(x);
}