Skip to content

Instantly share code, notes, and snippets.

View dartov's full-sized avatar

Anton Zadorožnyj dartov

  • Teradata
  • Prague
View GitHub Profile
@dartov
dartov / zshrc
Created December 30, 2011 09:59
my zshrc with oh-my-zsh
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="juanghurtado"
# Set to this to use case-sensitive completion
@dartov
dartov / edit.sh
Created January 22, 2012 18:05
Shell script to run native mac apps from command line
#!/bin/zsh
set -e
if [[ $# -ne 1 ]]; then
echo 'Sorry, need only one parameter'; exit 1;
fi
FILENAME="$1"
@dartov
dartov / dump_http.java
Created February 19, 2012 21:19
Simple HTTP dumping script for Greasyspoon and Mongo
//-------------------------------------------------------------------
// ==ServerScript==
// @name dump_http
// @status on
// @description Simple http dumping script
// @include .*
// @exclude
// @responsecode 200
// ==/ServerScript==
// --------------------------------------------------------------------
@dartov
dartov / logtodayone.rb
Created March 4, 2012 17:32
Brett Terpstra's script for logging to Day One
#!/usr/bin/ruby
# logtodayone.rb
# Brett Terpstra (http://brettterpstra.com)
# Use and modify freely, attribution appreciated
#
# This script works with the Day One[1] command line utility
# It parses an input string for an exclamation point prefix to mark starred
# and/or a [date string] at the beginning to parse natural language dates
#
@dartov
dartov / tmux_cluster.sh
Created July 25, 2012 15:14
Scripted tmux to open syncronized and separate windows for a cluster of servers
#!/bin/sh
# A rather simple example of tmux scripting
# Sets a new session for a cluster of listed servers
# Session has a single window with every server in a cluster as separate pane with synchronized input,
# and an additional window for every machine in a cluster
export DISABLE_AUTO_TITLE=true # needed to fix names of windows
SERVER_LIST="server-1 server-2 server-3"
CLUSTER_NAME="some-cluster" # will be a name of the tmux session
@dartov
dartov / local_storm.sh
Created July 31, 2012 08:39
Tmux script to start local dev storm cluster
#!/bin/sh
export DISABLE_AUTO_TITLE=true
SESSION_NAME="local-storm"
tmux has-session -t $SESSION_NAME
if [ $? != 0 ]
then
@dartov
dartov / myscript.lua
Created September 19, 2012 13:48
Redis Lua "where" function
local keys = redis.call('hgetall',KEYS[1])
local i = ARGV[1]
local key
local value
for k,v in ipairs(keys) do
if k % 2 == 0 then
value = v
else
@dartov
dartov / git_demo.sh
Created February 14, 2014 12:20
A simple demo how one can alter history on git server
# Creating a local git server
mkdir -p git_show/git_server
cd git_show/git_server
git init --bare
# Initiating the repo with first commit
cd ../
@dartov
dartov / create_user.yml
Created April 21, 2015 07:21
Adding power user with ansible
#
# Simple playbook to create passwordless sudo user with pubkey authentication for future ansible use
# This assumes you know some other user login/pass
#
# Three simple steps:
# 1. Create some public key: ssh-keygen -t rsa -C "me@example.com"
# 2. Add some inventory into inventory file
# 3. Run playbook: ansible-playbook -i inventory create_user.yml -e "createuser=myuser pubkey_file=~/.ssh/my_pubkey.pub" -u someotheruser -k
#
---
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property>
<name>jobTracker</name>
<value>master.saekiyoshiyasu.org:8021</value>
</property>
<property>
<name>nameNode</name>
<value>hdfs://master.saekiyoshiyasu.org:8020</value>
</property>