Skip to content

Instantly share code, notes, and snippets.

View koffeinfrei's full-sized avatar

Alexis Reigel koffeinfrei

View GitHub Profile
@koffeinfrei
koffeinfrei / .gitignore
Created September 13, 2011 20:01
Codebrawl #10
input.png
/Gemfile.lock
@koffeinfrei
koffeinfrei / process_locking_clipboard
Created November 21, 2011 08:28
Gets the process that locks the clipboard (i.e. openened but didn't close it)
using System;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace ConsoleApplication1
{
public class Program
{
[DllImport("user32.dll")]
static extern IntPtr GetOpenClipboardWindow();
@koffeinfrei
koffeinfrei / backtracking-sudoku-solver.rb
Created October 16, 2012 10:49
really stupid backtracking sudoku solver
=begin
ruby solver
=end
$count = 0
def valid?(state, x, y)
# check in col and row
0.upto(8) do |i|
return false if i != y and state[x][i] == state[x][y]
@koffeinfrei
koffeinfrei / combinations.rb
Last active December 11, 2015 11:48
3 char combinations (of my name)
# try pairs of 2
def pairs_of_2(names)
slices = names.join.scan(/.{2}/)
combinations(slices)
end
# try each chars
def pairs_of_chars(names)
chars = names.join.chars.to_a.uniq
combinations(combinations(chars))
@koffeinfrei
koffeinfrei / README.md
Last active August 29, 2015 13:56
rails rake task for checking validity of all rails model entries

Put this file in your rails project at lib/tasks/db.rake. Use it like

$ rake db:data:validate
@koffeinfrei
koffeinfrei / README.md
Last active August 29, 2015 14:02
git through proxy
  1. install socat

  2. add git-proxy to your path (e.g. cp git-proxy ~/bin/)

  3. make git-proxy executable (e.g. chmod u+x git-proxy)

  4. add ssh config ssh_config entries to your ssh config (samples for github)

  5. edit the proxy address in git-proxy

  6. edit the proxy address in ssh_config

  7. add git configuration

    needed for ssh urls that require a login (git@github.com:someone/something.git)

@koffeinfrei
koffeinfrei / svn_authors.rb
Last active August 29, 2015 14:03
svn authors
# Koffeinfrei svn_authors.rb
# Copyright (C) 2011 Alexis Reigel
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@koffeinfrei
koffeinfrei / README.md
Last active August 29, 2015 14:06 — forked from busterbenson/markov_tweets.rb
Horse koffeinfrei (markov twitter bot)

Getting started

  1. Setup new horse twitter account
  • Create a new Twitter account that you'd like to have your auto-tweets posted to
  • Go to dev.twitter.com, create a new application with Read+Write permissions
  • Create an access token + secret for the account and copy that and the consumer key and secrets.
  1. Get your twitter archive
  • Go to Twitter.com -> Settings -> Download Archive.
  • The tweets.csv file is in the top directory. Put it in the same directory as this script.
@koffeinfrei
koffeinfrei / .gitignore
Last active May 26, 2021 15:09
Ruby system call benchmark
.bundle/
@koffeinfrei
koffeinfrei / git-fame.sh
Last active September 22, 2017 09:11
git relevant contributors -> https://github.com/koffeinfrei/git-alpha
#!/bin/sh
# Help output
help() {
echo "Usage: git-fame [options] <repository_path>"
echo " -m Machine readable output"
echo " -h Print this help"
exit 1
}