Skip to content

Instantly share code, notes, and snippets.

View radeksimko's full-sized avatar

Radek Simko radeksimko

View GitHub Profile
@radeksimko
radeksimko / gist:1240638
Created September 25, 2011 14:17
ElasticSearch bash init file
#! /bin/bash
### BEGIN INIT INFO
# Provides: elasticsearch
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts elasticsearch
# Description: Starts elasticsearch using start-stop-daemon
### END INIT INFO
@radeksimko
radeksimko / get_all_indexes.js
Created May 6, 2012 12:53
Mongo - List all indexes + versions
db.getCollectionNames().forEach( function ( collectionName ) {
print( collectionName );
var indexes = db.eval( 'db.' + collectionName + '.getIndexes()' );
indexes.forEach( function( index ) {
print( ' - (v ' + index.v + ') ' + index.name );
});
});
@radeksimko
radeksimko / gist:3786224
Created September 26, 2012 05:13 — forked from anonymous/gist:3784593
Which way of writing do you like more?
// third way
$example->foo(2, 2)
->andReturn(4)
->foo(4, 4)
->andReturn(8)
->foo(8, 8)
->andReturn(16);
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch/status of the current git repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/
git clone git://github.com/wbond/sublime_package_control.git Package\ Control
cd Package\ Control
git checkout python3
# restart Sublime Text 3 and you should have Package Control working
@radeksimko
radeksimko / gist:9260956
Last active February 25, 2022 10:28
Remove icons from OSX Dock
idsToRemove=(
"com.apple.Notes"
)
plistBuddy='/usr/libexec/PlistBuddy'
dockPlistPath="$HOME/Library/Preferences/com.apple.dock.plist"
for appIDToRemove in $idsToRemove; do
iconsIndexes=`defaults read com.apple.dock persistent-apps | grep tile-type | awk '/file-tile/ {print NR}'`

Keybase proof

I hereby claim:

  • I am radeksimko on github.
  • I am radeksimko (https://keybase.io/radeksimko) on keybase.
  • I have a public key whose fingerprint is A301 4A24 C699 8F16 7D31 FD77 1079 D611 5CFD 80AD

To claim this, I am signing this object:

@radeksimko
radeksimko / .bash_profile
Last active December 5, 2019 21:51
New MacOS bootstrap
export GOPATH=$HOME/gopath
# Path
export PATH=/opt/local/bin:/usr/local/bin:/opt/local/sbin:/usr/local/sbin:$PATH
export PATH=/usr/local/share/npm/bin:$PATH # NPM
export PATH=/usr/local/mysql/bin:$PATH # MySQL
export PATH=/usr/local/pear/bin:$PATH # Pear
export PATH=/usr/local/opt/gnu-sed/libexec/gnubin:$PATH # sed
export PATH=$GOPATH/bin:$PATH # Go
#!/usr/local/bin/bash
RESULTS=`grep ' version ' ./Casks/*.rb`
for RESULT in $RESULTS; do
FILE=$(echo $RESULT | cut -d: -f 1)
VERSION=$(echo $RESULT | cut -d\' -f 2)
OCCURENCE=$(grep -c '$VERSION' $FILE)
if [[ $OCCURENCE -ge 2 ]]; then
@radeksimko
radeksimko / ami-search.sh
Last active August 29, 2015 14:15
Search same AMI in different regions, output in Terraform format
AMI_ID=$1
REGION=$2
output=$(aws --region $REGION ec2 describe-images \
--filter "Name=image-id,Values=$AMI_ID" --output=text | head -1)
ORIGINAL_AMI_NAME=$(echo "$output" | awk -F\t '{print $11}')
ORIGINAL_AMI_OWNER=$(echo "$output" | awk -F\t '{print $12}')
if [[ ! $ORIGINAL_AMI_OWNER =~ ^[0-9]{10,}$ ]]; then