Skip to content

Instantly share code, notes, and snippets.

@honza
honza / gist.md
Created June 30, 2013 23:03
Clojure vs Haskell

Haskell vs Clojure

The JSON data is in the following format

{
    "Genesis": {
        "1": {
            "1": "In the beginning..." ,
            "2": "..."
@honza
honza / sigterm.py
Created April 6, 2012 22:22
Sigterm handler in Python
"""
This snippet shows how to listen for the SIGTERM signal on Unix and execute a
simple function open receiving it.
To test it out, uncomment the pid code and kill the process with:
$ kill -15 pid
"""
import signal
import sys
@honza
honza / strip.js
Created August 3, 2011 14:30
Strip MS Word formatting in javascript
// Source: http://www.1stclassmedia.co.uk/developers/clean-ms-word-formatting.php
function CleanWordHTML( str )
{
str = str.replace(/<o:p>\s*<\/o:p>/g, "") ;
str = str.replace(/<o:p>.*?<\/o:p>/g, "&nbsp;") ;
str = str.replace( /\s*mso-[^:]+:[^;"]+;?/gi, "" ) ;
str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, "" ) ;
str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ;
str = str.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, "" ) ;
@honza
honza / books.py
Last active February 28, 2023 21:50
books = [
"Genesis",
"Exodus",
"Leviticus",
"Numbers",
"Deuteronomy",
"Joshua",
"Judges",
"Ruth",
"1 Samuel",
@honza
honza / words.csv
Last active February 2, 2023 15:07
Word Explanation
Adria the Adriatic sea.
After this manner in this way.
Alleluia praise the LORD.
Anathema under a curse.
Away with take away.
Away with him take him away.
Barbarian foreigner.
Barbarians foreigners.
Bishop overseer.
@honza
honza / list.json
Created September 16, 2022 17:09
TBS Textual Key
[
{
"name": "Matthew",
"entries": [
{
"chapter": "1",
"verse": "7",
"text": "‘Asa’ is changed to ‘Asaph’ [often this error is printed in the margin rather than in the text]",
"is_serious": false
},
@honza
honza / idle_fingers.py
Created February 25, 2011 19:25
IdleFingers Pygments Theme
# -*- coding: utf-8 -*-
"""
Idle-Fingers Colorscheme
~~~~~~~~~~~~~~~~~~~~~~~~
Converted by Vim Colorscheme Converter
"""
from pygments.style import Style
from pygments.token import Token, Comment, Name, Keyword, Generic, Number, Operator, String
@honza
honza / description.md
Last active January 4, 2022 00:54
Ranking algorithm - Lower bound of Wilson score confidence interval for a Bernoulli parameter All implementations use 95% probability.

Ranking algorithm

Lower bound of Wilson score confidence interval for a Bernoulli parameter

All implementations use 95% probability.

pos is the number of positive votes, n is the total number of votes.

Source

git clone https://github.com/openshift/machine-api-operator.git
cd machine-api-operator/
oc --as system:admin apply -f install/0000_30_machine-api-operator_00_namespace.yaml
oc --as system:admin apply -f install/0000_30_machine-api-operator_01_images.configmap.yaml
oc --as system:admin apply -f install/0000_30_machine-api-operator_02_machine.crd.yaml
oc --as system:admin apply -f install/0000_30_machine-api-operator_03_machineset.crd.yaml
oc --as system:admin apply -f install/0000_30_machine-api-operator_04_machinedeployment.crd.yaml
oc --as system:admin apply -f install/0000_30_machine-api-operator_05_cluster.crd.yaml
oc --as system:admin apply -f install/0000_30_machine-api-operator_06_machineclass.crd.yaml
{
"apiVersion": "v1",
"items": [
{
"apiVersion": "metalkube.org/v1alpha1",
"kind": "BareMetalHost",
"metadata": {
"annotations": {
"kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"metalkube.org/v1alpha1\",\"kind\":\"BareMetalHost\",\"metadata\":{\"annotations\":{},\"name\":\"example-baremetalhost\",\"namespace\":\"bmo-project\"},\"spec\":{\"bmc\":{\"credentialsName\":\"bmc1-secret\",\"ip\":\"192.168.100.100\"},\"online\":true}}\n"
},