Skip to content

Instantly share code, notes, and snippets.

View omegahm's full-sized avatar

Mads Ohm Larsen omegahm

View GitHub Profile

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@omegahm
omegahm / create_labels.sh
Created April 7, 2015 19:00
Create Gtihub labels from Bash
#!/usr/bin/env bash
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
###
# Label definitions
###
declare -A LABELS
# Platform
@omegahm
omegahm / .bashrc
Created March 13, 2014 08:55
Snippet from .bashrc
export PROMPT_COMMAND=__prompt_command
function __prompt_command() {
local EXIT="$?"
PS1="\[${YELLOW}\]\u\[${RESET}\]"
PS1+="@"
PS1+="\[${CYAN}\]\H\[${RESET}\] "
PS1+="\[${WHITE}\]\w\[${RESET}\] "
PS1+="\n"
@omegahm
omegahm / quasicrystal.py
Last active April 28, 2021 01:44
Quasicrystals in Python
# -*- coding: utf-8 -*-
import bohrium as np
from math import pi
import matplotlib.pyplot as plt
import matplotlib.colors as colors
fig = plt.figure()
plt.xticks([])
plt.yticks([])
@omegahm
omegahm / graph.rb
Last active June 8, 2020 12:41
Generate nice Dependency Hierarchy Graph of Gems
#!/usr/bin/env ruby
require 'json'
gemfile = ARGV[0] || 'Gemfile.lock'
gems = {}
last_gem = ''
name = ''
File.readlines(gemfile).each do |line|
require 'rspec'
RSpec.describe do
%w(spongebobify minisponge).each do |method|
context "##{method}" do
it 'fox' do
expect(send(method, 'fox')).to eq('fOx')
expect(send(method, 'FOX')).to eq('fOx')
end
@omegahm
omegahm / def.rb
Last active May 22, 2019 09:20
Time differences?
def run
t = 12.hours.from_now
n = Time.zone.now
puts t
puts n
puts (t.to_datetime - n.to_datetime)
puts (t.to_datetime - n.to_datetime).to_f
(t.to_datetime - n.to_datetime).ceil
end
@omegahm
omegahm / add_benchmark.rb
Created December 15, 2017 18:56
Benchmarking various array addition techniques with Ruby
require "benchmark"
n = 100_000_000
puts "ADD"
puts "n = #{n}"
Benchmark.bm(20) do |measure|
measure.report("zip") do
output = ""
@omegahm
omegahm / ext-blas.py
Created February 21, 2017 10:06
Testing BLAS extension for Bohrium
a = np.random.rand(2000, 3000).astype(np.float32)
b = np.random.rand(3000, 4000).astype(np.float32)
t0 = time()
c = np.dot(a, b)
t1 = time()
print "[Numpy] It took {}s".format(t1-t0)
print c
#print
# -*- coding: utf-8 -*-
import numpy as np
from sys import argv
from matplotlib import pyplot as plt
from matplotlib import colors
def mandelbrot(c, maxiter, h, log_log_h):
output = np.empty(c.shape, np.float64)
z = np.empty(c.shape, np.complex64)
az = np.zeros(c.shape, np.complex64)