Skip to content

Instantly share code, notes, and snippets.

View krig's full-sized avatar
🏠
Working from home

Kristoffer Grönlund krig

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am krig on github.
  • I am krig (https://keybase.io/krig) on keybase.
  • I have a public key whose fingerprint is 413B B235 E6E1 50B7 0B24 FCD5 ACD2 45E4 7872 96B8

To claim this, I am signing this object:

options_wait = True
def test_should_wait():
def f1(options_wait, rv, command_wait, level_should_wait, in_transit, interactive):
return options_wait and rv and (command_wait or (level_should_wait and (in_transit or not interactive)))
def f2(options_wait, rv, command_wait, level_should_wait, in_transit, interactive):
if not options_wait:
return False
@krig
krig / gist:5088ea9b9430ae1f7076
Created June 25, 2014 20:15
flatui palette as python
flatui_palette = {
'Untitled': '#1abc9c',
'Untitled': '#2ecc71',
'Untitled': '#3498db',
'Untitled': '#9b59b6',
'Untitled': '#34495e',
'Untitled': '#16a085',
'Untitled': '#27ae60',
'Untitled': '#2980b9',
'Untitled': '#8e44ad',
# Här är ett konkret exempel:
#
# 1. Inga namespaces:
def node_type_optional_no_namespaces(self):
path = '//element[@name="nodes"]//element[@name="node"]/optional/attribute[@name="type"]'
return len(schema.rng_xpath(path)) > 0
# 2. Namespaces:
[ 38s] /usr/lib64/ruby/gems/2.1.0/gems/bundler-1.10.6/lib/bundler/rubygems_integration.rb:292:in `block in replace_gem': json is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
[ 38s] from /home/abuild/rpmbuild/BUILD/hawk2-1.0.1+git.1448874643.e07e008/hawk/vendor/bundle/ruby/2.1.0/gems/po_to_json-1.0.1/lib/po_to_json.rb:26:in `<top (required)>'
[ 38s] from /home/abuild/rpmbuild/BUILD/hawk2-1.0.1+git.1448874643.e07e008/hawk/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `require'
[ 38s] from /home/abuild/rpmbuild/BUILD/hawk2-1.0.1+git.1448874643.e07e008/hawk/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:274:in `block in require'
[ 38s] from /home/abuild/rpmbuild/BUILD/hawk2-1.0.1+git.1448874643.e07e008/hawk/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:240:in `load_dependency'
[ 38s] from /home/abuild/rpmbuild/BUILD/hawk2-1.0.1+git.1448874643.e07e008/hawk/vendo
Environment
Bundler 1.10.6
Rubygems 2.2.2
Ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-linux-gnu]
Git 2.1.2
Bundler settings
gemfile
@krig
krig / .phrdict
Created January 21, 2013 22:15
Dictionary of the most common english words
the be and of a in to have to it I that for you he with on do say this
they at but we his from that not n't n't by she or as what go their
can who get if would her all my make about know will as up one time
there year so think when which them some me people take out into just
see him your come could now than like other how then its our two more
these want way look first also new because day more use no man find
here thing give many well only those tell one very her even back any
good woman through us life child there work down may after should call
world over school still try in as last ask need too feel three when
state never become between high really something most another much
@krig
krig / parseiso8601utc2.c
Created July 8, 2013 22:02
(hopefully) fixed iso8601 parser. Should work in GNU/Linux systems now, at least.
/* parses only YYYY-MM-DDTHH:MM:SSZ */
time_t
parseiso8601utc_fixed(const char *date)
{
struct tm tt = {0};
double seconds;
if (sscanf(date, "%04d-%02d-%02dT%02d:%02d:%lfZ",
&tt.tm_year, &tt.tm_mon, &tt.tm_mday,
&tt.tm_hour, &tt.tm_min, &seconds) != 6)
return -1;
@krig
krig / gist:e4ed6fc6b861658a8826b1838ca9ac5e
Created October 25, 2017 08:27
crmsh regression test suite output py3
Wed Oct 25 08:21:29 UTC 2017: BEGIN testcase confbasic
----------
testcase confbasic failed
output is in crmtestout/confbasic.out
diff (from crmtestout/confbasic.diff):
--- /usr/share/crmsh/tests/testcases/confbasic.exp 2017-10-25 08:21:25.000000000 +0000
+++ - 2017-10-25 08:21:31.832475548 +0000
@@ -22,2 +22,3 @@
.INP: master m d4
+ERROR: 21: Cannot create ms with ID 'm': Found existing ms with same ID.
@krig
krig / deannex.py
Last active June 21, 2018 20:48
Get files out of git-annex without any dependencies except Python 3
#!/usr/bin/python3
#
# A small utility for pulling files out of git-annex without
# actually having git-annex installed, with minimal
# dependencies.
import sys
import os
import argparse
import shutil
import hashlib