Skip to content

Instantly share code, notes, and snippets.

View markjeee's full-sized avatar
🏃‍♂️
Working from anywhere

Mark John Buenconsejo markjeee

🏃‍♂️
Working from anywhere
View GitHub Profile
-- Shamelessly stolen from:
-- https://www.cs.york.ac.uk/ftpdir/pub/haskell/contrib/Roman.hs
module Roman (numerals) where
import Data.Maybe (fromJust, fromMaybe)
numerals n = Just $ toRoman n
numH = [ ('I', 1), ('V', 5), ('X', 10), ('L', 50),
module WordCount where
import Data.Char
import Data.List
import Data.Map (fromList)
wordCount s = fromList $ map (\s -> (head s, length s)) $ groupByWords s
normCase :: String -> String
normCase s = [ toLower x | x <- s ]
@markjeee
markjeee / keybase.md
Created September 25, 2016 11:26
Keybase public verification

Keybase proof

I hereby claim:

  • I am markjeee on github.
  • I am markjeee (https://keybase.io/markjeee) on keybase.
  • I have a public key ASCG8jo0TDdnDHJlTARvMjhOmCTFsWTEYHsrAdcEX0fLigo

To claim this, I am signing this object:

@markjeee
markjeee / tmux.md
Created May 10, 2016 13:57 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

## Context
Two dataset.import() calls happen on the same table.
## Stack trace
/home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/logging.rb:58:in `query': Mysql2::Error: Deadlock found when trying to get lock; try restarting transaction (Sequel::SerializationFailure)
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/logging.rb:58:in `block in log_connection_execute'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/logging.rb:33:in `log_yield'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/logging.rb:58:in `log_connection_execute'
@markjeee
markjeee / q.rb
Last active November 19, 2015 22:17
require 'pp'
OPS = [ '+', '-', '*', '/' ]
def generate_combos(n, &block)
n_len = n.length
chars = n_to_chars_with_pads(n)
OPS[0..0].each_index do |ops_i|
transform(chars, n_len, 0, ops_i, &block)
# split mp3 files in 5 secs interval, -n -x strip tags on the resulting mp3 files.
mp3splt -t 0.5 -n -x demo.mp3
*~
~*
*#
#*
.#*
.gitignore
*.swp
*.swo
.sass-cache
log
#!/usr/bin/ruby
require 'yaml'
ROOT_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..'))
ENV_DEFAULTS = {
'ruby_path' => (r = `which ruby`.strip).empty? ? '/usr/bin/ruby' : r,
'env_path' => (r = `which env`.strip).empty? ? '/usr/bin/env' : r,
'cwd' => ROOT_PATH
# Installs ruby1.8 ruby1.9 ruby1.9.1 found on Lucid as alternatives. Easily switch between them.
# Originally from: http://groups.google.com/group/rails-oceania/browse_thread/thread/8a2b256d117db49f
# become root
su
# make sure the packages are installed for 1.8 & 1.9
aptitude install -s ~n^ruby1.[89]$ ~n^irb1.[89]$ ~n^ri1.[89]
# install ruby1.8 & friends with priority 500