Skip to content

Instantly share code, notes, and snippets.

View dvapelnik's full-sized avatar

Dmitry Vapelnik dvapelnik

  • Ukraine, Vinnitsa
View GitHub Profile
@dvapelnik
dvapelnik / config.py
Last active April 27, 2018 12:25
Translate in command line using YandexTranslateAPI
YandexApiKey = 'Your.Yandex.Translate.API.Key.Should.Be.Here'
@dvapelnik
dvapelnik / .bashrc
Created June 13, 2017 21:34 — forked from vsouza/.bashrc
Golang 1.5 setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@dvapelnik
dvapelnik / Symfony2 GraphvizDumper demo
Created December 26, 2016 19:13 — forked from fgm/Symfony2 GraphvizDumper demo
Demonstrate how to use the GraphViz Dumper in a Symfony 2.4 project.
<?php
/**
* @file
* gvdump.php
*
* @author: Frédéric G. MARAND <fgm@osinet.fr>
*
* @copyright (c) 2014 Ouest Systèmes Informatiques (OSInet).
*
* @license MIT
#!/bin/sh
yum -y groupinstall "Development Tools"
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh epel-release-5*.rpm
rpm -Uvh remi-release-5*.rpm
yum -y install python-devel screen
yum --enablerepo=remi install libcurl-devel -y
mkdir /opt/miner
cd /opt/miner
@dvapelnik
dvapelnik / .gitconfig
Created October 31, 2016 15:53
Pretty git branch graphs
[alias]
# Look http://stackoverflow.com/questions/1057564/pretty-git-branch-graphs
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
@dvapelnik
dvapelnik / cmd.sh
Created October 27, 2016 08:51 — forked from kelvinn/cmd.sh
Example of using Apache Bench (ab) to POST JSON to an API
# post_loc.txt contains the json you want to post
# -p means to POST it
# -H adds an Auth header (could be Basic or Token)
# -T sets the Content-Type
# -c is concurrent clients
# -n is the number of requests to run in the test
ab -p post_loc.txt -T application/json -H 'Authorization: Token abcd1234' -c 10 -n 2000 http://example.com/api/v1/locations/
@dvapelnik
dvapelnik / ogp.html
Created October 25, 2016 17:07
OpenGraph Protocol by @maggg
<!-- Для Фейсбука, Вконтакта, Одноклассников и Гуглплюса -->
<meta property="og:type" content="website">
<meta property="og:site_name" content="Название сайта">
<meta property="og:title" content="Заголовок">
<meta property="og:description" content="Описание.">
<meta property="og:url" content="http://example.com/page.html">
<meta property="og:locale" content="ru_RU">
<meta property="og:image" content="http://example.com/img.jpg">
<meta property="og:image:width" content="968">
<meta property="og:image:height" content="504">
@dvapelnik
dvapelnik / y-factorial.php
Created February 6, 2016 22:54
Y-Combinator in PHP
<?php
// Source: https://php100.wordpress.com/2009/04/13/php-y-combinator/
function Y($F)
{
$func = function ($f) {
return $f($f);
};
return $func(
function ($f) use ($F) {
@dvapelnik
dvapelnik / tmux-cheatsheet.markdown
Created December 21, 2015 21:18 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dvapelnik
dvapelnik / meta-tags.md
Created December 20, 2015 10:08 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>