Skip to content

Instantly share code, notes, and snippets.

View nLight's full-sized avatar
:shipit:

Dmitriy (Dima) Rozhkov nLight

:shipit:
View GitHub Profile
@nLight
nLight / better-hash-function.js
Created October 19, 2019 09:21
Javascript Hash Table
function hash(string) {
let index = 0;
for(let i = 0; i < string.length; i++) {
index += string.charCodeAt(i) * i;
}
return index % _size;
}
@nLight
nLight / stream.js
Last active August 3, 2018 20:11
Mesos stream replay server
const http = require('http')
const port = 3000
var fs = require('fs');
const requestHandler = (request, response) => {
console.log("Connected")
response.setHeader("Access-Control-Allow-Origin", "*")
response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
@nLight
nLight / source-unmap.js
Created August 31, 2016 13:40
Unmap source map
var sourceMap = require('source-map');
var https = require('https');
var fs = require('fs');
var args = process.argv.slice(2);
if(args.length === 0) {
console.log("Usage: node index.js https://url.to/script.js:<line>:<column>");
return;
}
@nLight
nLight / .ssh-config
Created June 8, 2016 09:22
SSH Proxy
Host ssh-proxy
HostName proxy.example.com
User ubuntu
IdentityFile ~/.ssh/keys.pem
Host !ssh-proxy *
ProxyCommand ssh -q -W %h:%p ssh-proxy
ForwardAgent yes
@nLight
nLight / README.md
Last active November 21, 2015 13:38
GoPro Timer Proof of Concept
@nLight
nLight / keybase.md
Created March 2, 2015 08:58
keybase.md

Keybase proof

I hereby claim:

  • I am nlight on github.
  • I am nlight (https://keybase.io/nlight) on keybase.
  • I have a public key whose fingerprint is 8FED C304 4FB5 D7B2 DD66 4A50 66CC 39C2 2061 3D8F

To claim this, I am signing this object:

@nLight
nLight / .bashrc
Last active March 24, 2017 20:16
dots
# Git
## Git undo
alias gundo="git reset HEAD~1"
## Resolve conflicts
alias conflicts='git status -s | grep -e "^\(DD\|AU\|UD\|UA\|DU\|AA\|UU\)" | cut -d " " -f2'
alias resolve='conflicts | xargs subl'
alias cadd='conflicts | xargs git add'
## WIP
# ZSH Theme - Preview: http://cl.ly/350F0F0k1M2y3A2i3p1S
PROMPT='%{$fg_bold[green]%}λ%{$reset_color%} %~/ $(git_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
@nLight
nLight / redis_set.rb
Created May 29, 2014 09:45
Ruby array-like wrapper for redis sets.
require 'forwardable'
class RedisSet
extend Forwardable
def_delegators :to_ary, :first, :push, :shift, :size, :each, :map
def initialize(redis, key)
@redis = redis
@key = key
@nLight
nLight / index.html
Created May 9, 2014 18:01
Functional lenses in React.js with DrBoolean/lenses
<!DOCTYPE html>
<html>
<head>
<title>React JS Lenses</title>
<script src="react-with-addons.min.js"></script>
<script src="JSXTransformer.js"></script>
<!-- https://github.com/DrBoolean/lenses/blob/master/dist/lenses.browser.js -->
<script src="lenses.browser.js"></script>
<!-- https://github.com/DrBoolean/pointfree-fantasy/blob/master/dist/pointfree.browser.js -->