Skip to content

Instantly share code, notes, and snippets.

View ch3ll0v3k's full-sized avatar

Timoschenko Viacheslau ch3ll0v3k

View GitHub Profile
function getTileUrls(bounds, tileLayer, zoom) {
var min = map.project(bounds.getNorthWest(), zoom).divideBy(256).floor(),
max = map.project(bounds.getSouthEast(), zoom).divideBy(256).floor(),
urls = [];
for (var i = min.x; i <= max.x; i++) {
for (var j = min.y; j <= max.y; j++) {
var coords = new L.Point(i, j);
coords.z = zoom;
urls.push(tileLayer.getTileUrl(coords));
function getTileUrls(bounds, tileLayer, zoom) {
var min = map.project(bounds.getNorthWest(), zoom).divideBy(256).floor(),
max = map.project(bounds.getSouthEast(), zoom).divideBy(256).floor(),
urls = [];
for (var i = min.x; i <= max.x; i++) {
for (var j = min.y; j <= max.y; j++) {
var coords = new L.Point(i, j);
coords.z = zoom;
urls.push(tileLayer.getTileUrl(coords));
function getHSLColor( val ){
// normalize
val = (+val)>255?255:(+val)< 0?0:(+val);
// NON-STANDARD
// val = ((+val)-250) /285 - 320;
// h = (1 - (+val)) * 280;
// s = 100;
// l = (+val) * 50;
// l = 50;
@ch3ll0v3k
ch3ll0v3k / gist:0bb51f8f085255e35b8021831b43ab61
Created March 27, 2018 19:30 — forked from matthieu/gist:b07c5ba27bc99188a15f
Create and send a Bitcoin transaction using the BlockCypher Transaction API
# In this example we're sending some test bitcoins from an address we control to a brand new test
# address. We'll be sending the coins using the following address, public and private keys (please
# don't abuse).
# address : mtWg6ccLiZWw2Et7E5UqmHsYgrAi5wqiov
# public : 03bb318b00de944086fad67ab78a832eb1bf26916053ecd3b14a3f48f9fbe0821f
# private : 1af97b1f428ac89b7d35323ea7a68aba8cad178a04eddbbf591f65671bae48a2
# 1. generate a one-shot dummy address we're going to send money to
$ curl -X POST http://api.blockcypher.com/v1/btc/test3/addrs
{
@ch3ll0v3k
ch3ll0v3k / sendRawTransaction.js
Created March 25, 2018 15:33 — forked from raineorshine/sendRawTransaction.js
Sends a raw transaction with web3 v1.0 and Infura
const Web3 = require('web3')
const Tx = require('ethereumjs-tx')
// connect to Infura node
const web3 = new Web3(new Web3.providers.HttpProvider('https://mainnet.infura.io/INFURA_KEY'))
// the address that will send the test transaction
const addressFrom = '0x1889EF49cDBaad420EB4D6f04066CA4093088Bbd'
const privKey = 'PRIVATE_KEY'
[{
"address":"0x59416A25628A76b4730eC51486114c32E0B582A1",
"symbol":"☀️ PLASMA",
"decimal":6,
"type":"default"
},{
"address":"0xAf30D2a7E90d7DC361c8C4585e9BB7D2F6f15bc7",
"symbol":"1ST",
"decimal":18,
"type":"default"
@ch3ll0v3k
ch3ll0v3k / aes.java
Created August 20, 2017 20:28 — forked from ulymarins/aes.java
Java Encryption with AES
import java.math.BigInteger;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
echo-server-epoll
echo-server-poll
talk
talk.dSYM
@ch3ll0v3k
ch3ll0v3k / gist:b01ec0c96ee0896ba7cb74f453eb59df
Created September 30, 2016 21:25
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@ch3ll0v3k
ch3ll0v3k / Makefile
Created August 30, 2016 10:31 — forked from nzjrs/Makefile
Python ctypes example
all: test libtest.so testmodule
libtest.so: libtest.c
$(CC) -Wall -g -fPIC -shared -o $@ $? -lc
test: test_main.c libtest.o
$(CC) -o $@ $?
testmodule: testmodule.c
python setup.py build