Skip to content

Instantly share code, notes, and snippets.

View duksis's full-sized avatar
🇪🇺
I definitely will be slow to respond.

Hugo Duksis duksis

🇪🇺
I definitely will be slow to respond.
View GitHub Profile
@duksis
duksis / keybase.md
Created April 11, 2014 21:51
keybase.io

Keybase proof

I hereby claim:

  • I am duksis on github.
  • I am duksis (https://keybase.io/duksis) on keybase.
  • I have a public key whose fingerprint is 8013 D9C8 8BBF 0346 D8FA 8073 58C1 86B9 7847 F196

To claim this, I am signing this object:

@duksis
duksis / deep_foldl_test.exs
Last active August 29, 2015 14:15
Elixir deep_foldl
# # https://gist.github.com/ashneyderman/5c88439c68b19ecf50d5
# @type reducer :: (term, term -> term)
# @spec deep_foldl(list, term, reducer) :: term
#
# ## deep folds should accept arbitrarily deep nested lists
# ## it should call the fun on anything which is not a list.
# ## For a flat list, it should do the same thing as erlang's
# ## lists:foldl/3.
#
# 15 = deep_foldl([[1,[2,[3,[4,5]]]]], 0, fn(N,Sum) -> N+Sum end).
@duksis
duksis / gist:3a722a0a2dead78afd01
Created May 27, 2015 21:53
heroku-buildpack-elixir not working with Erlang R16B
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> elixir app detected
remote: -----> Checking Erlang and Elixir versions
remote: Will use the following versions:
remote: * Stack cedar-14
remote: * Erlang R16B
remote: * Elixir 0.10.2
@duksis
duksis / ext.rb
Created February 15, 2012 21:26
Capistrano receipt configure logrotate
namespace :deploy do
desc "Configure logrotate"
task :logrotate, :roles => :install do
config_file = "/etc/logrotate.d/app_#{rails_env}"
config_lines = ["daily",
"rotate 10",
"missingok",
"nocompress",
"sharedscripts",
@duksis
duksis / cisco_decrypt.c
Created June 28, 2012 11:26
Cisco VPN group password decryptor
/* Decoder for password encoding of Cisco VPN client.
Copyright (C) 2005 Maurice Massar
Thanks to HAL-9000@evilscientists.de for decoding and posting the algorithm!
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@duksis
duksis / log.rb
Created November 26, 2012 16:03 — forked from tmikoss/log.rb
Capistrano recipes for remote log viewing
namespace :log do
desc "Search from log files on server"
task :grep, :roles => :app do
run "cd #{current_path}/log && grep #{ENV['str']} -B #{ENV['before'] || 5} -A #{ENV['after'] || 35} #{rails_env}.log*"
end
desc "Tail log files on servers"
task :tail, :roles => :app do
run "tail -f #{shared_path}/log/#{rails_env}.log" do |channel, stream, data|
puts "#{data}"
#!/usr/bin/env ruby
require "optparse"
require "uri"
class PreCiRunner
DEFAULTS = {
:jobs => [:wimdu, :wimdu_js, :wimdu_jasmine, :wimdu_guard_jasmine, :wimdu_checkout]
}
def initialize(attributes = {})
# bundle exec ruby live_coverage.rb
require 'simplecov'
SimpleCov.start 'rails'
puts 'required simplecov'
require './config/environment'
require 'rails/commands/server'
Rails::Server.start
#!/usr/bin/env ruby
#
# This file was generated by Bundler.
#
# The application 'unicorn' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
# helper function for creating double modules
# with function `call` returning initially provided data
#
# argument exampes:
# name = SomeModuleTest.ForTestCase
# data = [%{"some" => "data"}]
def create_double_module(name, data) do
contents = quote do
def call(_module, _fun, _args) do