Skip to content

Instantly share code, notes, and snippets.

gurix /
Created March 3, 2020 15:25
A script to determine what ruby versions for you use for different projects in a workspace.
#!/usr/bin/env python3
import glob, os, sys
from collections import Counter
# It is necessary to pass a directory in which we want to look for a ruby version.
if len(sys.argv) < 2:
sys.exit("usage: %s dir \n\n dir : Direcotry to look up for ruby version" % sys.argv[0])
# Validate the specified directory.
path_argument = sys.argv[1]
const images = require.context('../images')
const state = {
images: images.keys().map(function(name) {
name: name,
path: images(name,true)
$("tbody tr").each(function() {$(this).find("input[type=radio]")[Math.floor(Math.random()*4)].click()}); $("input[type=submit]").click();

Keybase proof

I hereby claim:

  • I am gurix on github.
  • I am gurix ( on keybase.
  • I have a public key ASBHKsemKRaojcS4rRd0o0sAt5MQmkfXVctr_YVVXCDS3wo

To claim this, I am signing this object:

gurix / easy_gov_review.ssml
Created July 2, 2018 18:51
EasyGov Review
<amazon:auto-breaths volume="x-loud" frequency="x-high">The following sequence shows the keyboard only navigation through the homepage of easygov from top to bottom. To do that, i am using the tabulator key. As you can see, the element that has the focus is sometimes highlighted with a light blue border.</amazon:auto-breaths></speak>
gurix /
Last active May 31, 2018 13:18
Cannabis Infused Masala Chai

Cannabis Infused Masala Chai



  • 0.2 dl Water
  • 0.2 dl Milk (high fat content)
  • 1 Gramm Cannabis
  • 1 Teabag Chai Tea
  • Sugar (as much as you prefere)
gurix /
Last active February 2, 2018 13:29
How to install pandoc on ueberspace 6

The following worklow based on the official documentation from pandoc

Install stack

Stack is not installed on ueberspace 6 by default. So we have to do install it manually.

  1. Download the release Linux 64-bit, static mannually according with the command wget
  2. It is a tar archive, but it does not save it with the correct suffix. However we cann extract the archive using tar -xzf linux-x86_64-static
  3. Copy the stack binary into your home binary folder cp stack-1.6.3-linux-x86_64-static/stack ~/bin/

Install pandoc

  1. Download the pandoc source wget
  2. Extract the archive tar xvzf pandoc-
gurix / randomizable.rb
Created November 18, 2015 16:36
Concern to get random document(s) from a model via mongoid, see
module Randomizable
extend ActiveSupport::Concern
module ClassMethods
def random(n = 1)
indexes = (0..count - 1).sort_by { rand }.slice(0, n).collect!
return skip(indexes.first).first if n == 1 { |index| skip(index).first }
gurix / alpha.R
Created November 11, 2015 09:24
Monkey patch alpha function in psych package to suppress the direct output for items were negatively correlated with the total scale
"alpha" <- function(x,keys=NULL,cumulative=FALSE,title=NULL,max=10,na.rm=TRUE,check.keys=FALSE,n.iter=1,delete=TRUE,use="pairwise") { #find coefficient alpha given a data frame or a matrix
alpha.1 <- function(C,R) {
n <- dim(C)[2]
alpha.raw <- (1- tr(C)/sum(C))*(n/(n-1))
alpha.std <- (1- n/sum(R))*(n/(n-1))
smc.R <- smc(R)
G6 <- (1- (n-sum(smc.R))/sum(R))
av.r <- (sum(R)-n)/(n*(n-1))
sn <- n*av.r/(1-av.r)