Skip to content

Instantly share code, notes, and snippets.

View VladRassokhin's full-sized avatar

Vladislav Rassokhin VladRassokhin

View GitHub Profile
@VladRassokhin
VladRassokhin / ckan.sh
Last active August 29, 2015 14:25
CKAN bash completion
View ckan.sh
_ckan()
{
local cur=${COMP_WORDS[COMP_CWORD]}
if [ $COMP_CWORD -eq 1 ]; then
# Complete command
local commands="$(ckan help 2>&1 | grep -e '^ ' | awk '{print $1}')"
COMPREPLY=( $(compgen -W "$commands" -- $cur) )
return
fi
local command="${COMP_WORDS[1]}"
@VladRassokhin
VladRassokhin / raid_ephemeral.sh
Last active August 29, 2015 14:27 — forked from joemiller/raid_ephemeral.sh
detect all ephemeral disks on EC2 then stripe together in a raid-0 vol mounted at /mnt
View raid_ephemeral.sh
#!/bin/bash
#
# this script will attempt to detect any ephemeral drives on an EC2 node and create a RAID-0 stripe
# mounted at /mnt. It should be run early on the first boot of the system.
#
# Beware, This script is NOT fully idempotent.
#
METADATA_URL_BASE="http://169.254.169.254/2012-01-12"
@VladRassokhin
VladRassokhin / SampleBuildFeature.java
Created October 1, 2015 16:24
TeamCity Build Feature with default values and radio buttons
View SampleBuildFeature.java
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@VladRassokhin
VladRassokhin / gravatar.tag
Created June 8, 2012 23:15
Simple gravatar.tag for JSP
View gravatar.tag
<%@ tag import="java.util.Formatter"
%><%@ tag import="java.security.MessageDigest"
%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ attribute name="email" required="true" type="java.lang.String"
%><%@ attribute name="sz" required="false" type="java.lang.Integer"
%><c:if test="${empty sz}"><c:set var="sz">20</c:set></c:if><c:choose
><c:when test="${empty email}"><c:set var="hash">00000000000000000000000000000000</c:set></c:when><c:otherwise
><c:set var="hash"><%=javax.xml.bind.DatatypeConverter.printHexBinary(MessageDigest.getInstance("MD5").digest(email.toLowerCase().trim().getBytes("UTF-8"))).trim().toLowerCase()%></c:set></c:otherwise
></c:choose><img class="gravatarimg${sz}" src="http://www.gravatar.com/avatar/${hash}?s=${sz}&d=mm" alt="">
@VladRassokhin
VladRassokhin / rvm-shell-test-runnner.sh
Created July 25, 2012 15:00
Test for .rvmrc formats
View rvm-shell-test-runnner.sh
#!/bin/bash -l
# Cleaning env
rvm use system
##
## This works fine return '1.9.3@acme'
##
echo "with 'use', must report 1.9.3@acme"
@VladRassokhin
VladRassokhin / wtf.kt
Created October 3, 2012 17:37
Kotlin wtf???
View wtf.kt
public class A {}
public class As {
[com.google.api.client.util.Key("a")] public var projects: List<A?>
get() {
return projects
}
set(list) {
projects = list
}
@VladRassokhin
VladRassokhin / gist:5955507
Created July 9, 2013 07:57
RVM useful scripts
View gist:5955507
  • Cleanup gemsets (remove all gems from them)
for f in `ls .rvm/gems/ | grep @`; do
  rvm use $f; 
  gem list | awk '{print $1}' | xargs -I '{}' gem uninstall -a '{}';
done
  • Remove non-global gemsets
View Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
@VladRassokhin
VladRassokhin / Gemfile
Created April 11, 2016 17:54
Rails master rake failure
View Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
#gem 'rails', '>= 5.0.0.beta3', '< 5.1'
gem 'rails', github: "rails/rails"
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma'
@VladRassokhin
VladRassokhin / console-output.log
Created June 20, 2016 16:22
vagrant box remove ubuntu/trusty64 --box-version '< 20160602.0.0'
View console-output.log
$ vagrant box remove ubuntu/trusty64 --box-version '< 20160602.0.0'
You requested to remove the box 'ubuntu/trusty64' version '< 20160602.0.0' with
provider 'virtualbox', but that specific version of the box is
not installed. Please double-check and try again. The available versions
for this box are:
* 20150512.0.1
* 20150609.0.10
* 20160208.0.0
* 20160222.0.0