Skip to content

Instantly share code, notes, and snippets.

View nordicdyno's full-sized avatar
😐

Alexander Orlovsky nordicdyno

😐
View GitHub Profile
from typing import List, Dict, Callable
from dataclasses import dataclass, field
import functools
# parameter modes:
p_mod = 0 # position mode
i_mod = 1 # immediate mode
# returns opcode & mode flags coded in instruction
def parse_instruction(opcode: int) -> (int, List[int]):
#!/bin/bash
# Illustrates my confusion with how to properly read events via Ethersan API
#
# Script code depends on bash and httpie util (https://httpie.org/)
#
# Based on https://etherscan.io/apis#accounts Get a list of "ERC20 - Token Transfer Events" by Address
#!/bin/bash
# https://etherscan.io/apis#accounts Get a list of "ERC20 - Token Transfer Events" by Address
@nordicdyno
nordicdyno / parallel-run-and-exit-on-error.go
Created October 24, 2019 11:25
одновременный запуск некоторого количества процессов в баше и потом нужно остановиться если хоть один умер и показать stdout
package main
import (
"fmt"
"log"
"os"
"os/exec"
"sync"
)
javascript:(() => { v = prompt('Issue Text:'); q = (() => { if (!v) return ""; return '?jql=' + `summary~"${v}" OR description~"${v}"`;})(); location = encodeURI('https://insolar.atlassian.net/issues/'+q);})();
from socket import socket, AF_INET, SOCK_DGRAM
import json
class StatsdClient(object):
def __init__(self, host='localhost', port=8125):
self.addr = (host, port)
self.udp_sock = socket(AF_INET, SOCK_DGRAM)
def gauge(self, name, value):
metric = "{0}:{1}|{2}".format(name, value, "g")
# HELP oom_kills The number of OOM kills since boot by process name
# TYPE oom_kills counter
oom_kills{procname="python"} 21
# HELP oom_kills_total The total number of OOM kills since boot
# TYPE oom_kills_total counter
oom_kills_total 21
# HELP oom_triggers The number of OOM trigger events since boot by process name
# TYPE oom_triggers counter
@nordicdyno
nordicdyno / nginx.conf
Created December 6, 2016 10:25 — forked from toxatoor/nginx.conf
HTTP Crawler
# HTTP crawler inside nginx.
#
# start crawling by curl http://127.0.0.1:18080/?host=<START URL>
#
worker_processes auto;
events {
worker_connections 16384;
}
@nordicdyno
nordicdyno / pgbouncer-create-userlist.yml
Created March 30, 2016 15:36 — forked from lesovsky/pgbouncer-create-userlist.yml
pgbouncer-create-userlist.yml
---
- hosts: all
vars:
userlist_file: /etc/pgbouncer/userlist.txt
userlist_owner: postgres
remote_user: root
tasks:
- name: "Stage 1: create temporary userlist.txt"
@nordicdyno
nordicdyno / The Technical Interview Cheat Sheet.md
Created December 23, 2015 10:30 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@nordicdyno
nordicdyno / pi.js
Last active December 6, 2015 01:44
proxy-images
javascript:(function() {
var proxyUrl = "http://d-nordicdyno.sports.ru/dl";
function replaceImages() {
var imgs = document.getElementsByTagName('img');
for (var i = 0; i < imgs.length; i++) {
var src = imgs[i].src;
if (src.indexOf("url=?") > -1) {
continue;
}
if (!/\.(jpg|jpeg|png|gif)$/.test(src)) {