Skip to content

Instantly share code, notes, and snippets.

View risentveber's full-sized avatar
🤠
angry cowboy

Boris Strelnikov risentveber

🤠
angry cowboy
View GitHub Profile
@risentveber
risentveber / Lifehacks.md
Last active July 18, 2018 11:38
Лайфхаки разработки

##Заметки разработчика

$ ssh-keyscan -t rsa server_ip

SQL

очистить содержимое таблицы и сбросить id

###Редирект с помощью nginx

server {
  #implemented by default, change if you need different ip or port
  #listen *:80 | *:8000;
  server_name test.com;
  return 301 $scheme://www.test.com$request_uri;
}
#ruby 2.3.1
require 'rbtree' # gem install rbtree
input = [
{ start:1, end: 40, price: 500 },
{ start:10, end: 22, price: 1000 },
{ start:22, end: 33, price: 700 },
{ start:39, end: 42, price: 800 },
]
new Promise(function(resolve){
setTimeout(function() {
console.log(1);
resolve();
}, 1000);
}).then(function() {
let nextPromise = new Promise(function(resolve){
setTimeout(function() {
console.log(2);
resolve();
var Benchmark = require('benchmark');
var suite = new Benchmark.Suite;
var testArray = [];
for (var s = 0; s < 100000; s++) {
testArray.push(Math.floor(Math.random() * 100));
}
console.log('Testing caching')
import itertools
import math
import sys
count = 0
n = int(sys.argv[1])
for left in itertools.permutations(range(1, n + 1)):
for right in itertools.permutations(range(1, n + 1)):
rIsGood = all(i + 1 != r for i, r in enumerate(right))
@risentveber
risentveber / HttpProxy.go
Created June 20, 2018 15:33 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@risentveber
risentveber / Arbitrage.js
Created July 16, 2018 14:12
Arbitrage with Bellman-Ford algo abstraction
const request = require('superagent');
const R = require('ramda');
function get(url) {
return new Promise((resolve, reject) => {
request
.get(url)
.end((err, res) =>{
if (err) {
reject(err);
#!/bin/sh
# set -- $GIT_PARAMS
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_IN_COMMIT=0
if [ -f $1 ]; then
BRANCH_IN_COMMIT=$(grep -c "\[$BRANCH_NAME\]" $1)
fi
#!/bin/sh
go test ./...