Skip to content

Instantly share code, notes, and snippets.

Avatar
👷‍♂️
Focusing

Viktor Evdokimov viktor-evdokimov

👷‍♂️
Focusing
View GitHub Profile
View import_and_parse_remote_csv_rails.md
require 'csv'
require 'open-uri'

csv_text = open('http://www.vvv.hh.yyy.ggg/~hhhh/uuuu.csv')
csv = CSV.parse(csv_text, :headers=>true)
csv.each do |row|
  puts row
end
@viktor-evdokimov
viktor-evdokimov / introrx.md
Created May 25, 2018 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
@viktor-evdokimov
viktor-evdokimov / pre-commit.sh
Last active Apr 13, 2018
pre-commit git hook to stop you from commiting binding.pry
View pre-commit.sh
#!/bin/sh
exec 1>&2
if test $(git diff --cached -S'binding.pry' --name-only |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Remove biniding.pry
EOF
exit 1
fi
@viktor-evdokimov
viktor-evdokimov / Untitled-3
Last active Apr 5, 2018
return which shell is used
View Untitled-3
# return which shell is used
> echo $0
-zsh
@viktor-evdokimov
viktor-evdokimov / index.js
Created Oct 30, 2017
Node.js and micro simple web service for running in K8S with draft
View index.js
const http = require('http')
const { run, send, json } = require('micro')
const PORT = process.env.PORT || 8080
const response = "Hi from MICROservice on K8S draft"
const microHttp = fn => http.createServer((req, res) => run(req, res, fn))
const server = microHttp(async (req, res) => {
const js = await json(req);
const statusCode = 200;
const data = { ...js, response };
@viktor-evdokimov
viktor-evdokimov / Gemfile
Created Oct 30, 2017
Simple sinatra powered ruby service
View Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "sinatra", "~> 2.0"
gem "json", "~> 2.1"
@viktor-evdokimov
viktor-evdokimov / pre-push.sh
Created Jul 14, 2017 — forked from pixelhandler/pre-push.sh
Git pre-push hook to prevent force pushing master branch
View pre-push.sh
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@viktor-evdokimov
viktor-evdokimov / rbt_publish.sh
Created Jun 19, 2017
publish myjson.json to rabbitmq
View rbt_publish.sh
bash python rabbitmqadmin publish exchange=amq.default routing_key=test payload="$(cat myjson.json)"
@viktor-evdokimov
viktor-evdokimov / move_to_new_branch.sh
Created Jun 6, 2017
move last commit to the new branch
View move_to_new_branch.sh
# Moving to a new branch
# Unless there are other circumstances involved, this can be easily done by branching and rolling back.
# Note: Any changes not committed will be lost.
git branch newbranch # Create a new branch, saving the desired commits
git reset --hard HEAD~1 # Move master back by 3 commits (GONE from master)
git checkout newbranch # Go to the new branch that still has the desired commits
#from https://stackoverflow.com/questions/1628563/move-the-most-recent-commits-to-a-new-branch-with-git
View git-reup
#!/usr/bin/env ruby
#
# Usage: git-up
# git-reup
#
# Like git-pull but show a short and sexy log of changes
# immediately after merging (git-up) or rebasing (git-reup).
#
# Inspired by Kyle Neath's `git up' alias:
# http://gist.github.com/249223
You can’t perform that action at this time.