Skip to content

Instantly share code, notes, and snippets.

View djhaskin987's full-sized avatar

Daniel Jay Haskin djhaskin987

View GitHub Profile
@djhaskin987
djhaskin987 / get_exe_version.c
Created January 27, 2016 19:08
Get version from EXE file on linux
/* Distributed under the CC-wiki license.
* user contributions licensed under cc by-sa 3.0 with attribution required: https://creativecommons.org/licenses/by-sa/3.0/
* Originally taken from the answer by @rodrigo, found here: http://stackoverflow.com/a/12486703/850326
*/
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <stdint.h>
#include <sys/stat.h>
from Levenshtein import distance
import subprocess
import re
import sys
import pprint
print("Running terraform plan...", file=sys.stderr)
proc = subprocess.run(
@djhaskin987
djhaskin987 / .gitattributes
Last active August 29, 2022 13:02
catch-all, end-all, One to Rule Them All, comprehensive gitattributes file; or, notes of my travels through other people's code.
# Use this line at your own risk
# * text=auto
# Editor save files
# (these should be in your gitignore)
*~ text
.*.sw[a-z] text
\#* text
.#* text
@djhaskin987
djhaskin987 / Feedly.opml
Created August 23, 2022 07:27
August 2022 Feedly OPML
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Daniel subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="Software" title="Software">
<outline type="rss" text="PingCAP Blog RSS Feed" title="PingCAP Blog RSS Feed" xmlUrl="https://pingcap.com/blog/index.xml" htmlUrl="https://pingcap.com"/>
<outline type="rss" text="f : ⊥ x ⊥ → ⊥" title="f : ⊥ x ⊥ → ⊥" xmlUrl="http://arrdem.com/atom.xml" htmlUrl="https://www.arrdem.com"/>
@djhaskin987
djhaskin987 / CANDL.md
Last active July 18, 2022 14:58
Convenient Arbitrarily Nestable Document Language

This Document Has Moved

This document is no longer being updated at this location. To see an up-to-date version, head over to its new home.

CANDL

Convenient
Arbitrarily
Nestable
@djhaskin987
djhaskin987 / png2icns
Created December 21, 2016 19:19
Convert PNG file to ICNS file
# Stolen from here: http://stackoverflow.com/a/20703594/850326
#!/bin/sh
export POSIXLY_CORRECT=1
if [ -z "${1}" -o -z "${2}" ]
then
echo "Usage: ${0} <name> <original-png-location>"
fi
name=$1
@djhaskin987
djhaskin987 / st2scheduler-scrubbed.log
Created December 19, 2018 19:59
Stackstorm Concurrency Error
2018-12-18 23:18:56,684 140672270229168 INFO handler [-] Scheduling liveaction: second_task_run (queue_item_id=5c19c6b022edb20192bc631f) (queue_item_id='5c19c6b022edb20192bc631f',liveaction_id='second_task_run')
2018-12-18 23:18:56,688 140672270229168 DEBUG policies [-] Applying pre-run policies for liveaction "second_task_run".
2018-12-18 23:18:56,690 140672270229168 DEBUG policies [-] Getting driver for policy "my_pack.my_pack.concurrency" (action.concurrency).
2018-12-18 23:18:56,690 140672270229168 DEBUG policies [-] Identified 1 policies for the action "my_pack.my-task".
2018-12-18 23:18:56,693 140672270229168 DEBUG concurrency [-] ConcurrencyApplicator is attempting to acquire lock "action=my_pack.my-task,policy_type=action.concurrency".
2018-12-18 23:18:56,693 140672270229168 INFO policies [-] Applying policy "my_pack.my_pack.concurrency" (action.concurrency) for liveaction "second_task_run".
2018-12-18 23:18:56,694 140672265936400 DEBUG connection [-] Sending request(xid=18): Exists(path=u'/tooz/locks
@djhaskin987
djhaskin987 / Main.hs
Created November 18, 2018 02:24
Haskell JSON-RPC nested struct server example
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
-- The purpose of this RPC example is to show how to define a method using
-- JSON-RPC in Haskell without having to explicitly write the deserialization
-- code. It also shows at the same time that nested structs in the `params`
-- object in the RPC call are possible and even easy.
--
-- It is built off of the original json-rpc server example, found here:
@djhaskin987
djhaskin987 / mistral_logs
Created June 28, 2018 22:09
mistral_hangs
2018-06-28 21:38:37.101 29017 INFO mistral.notifiers.notification_server [req-22840e07-dbe4-4213-9ab7-a2b6ae0fe840 - - - - -] Received RPC request 'notify'[ex_id=fca02cf9-e359-4f15-8399-f87fed8f5b51, event=WORKFLOW_FAILED, timestamp=2018-06-28T21:38:36.000000, data={u'workflow_name': u'examples.mistral-basic', u'updated_at': u'2018-06-28 21:38:36', u'workflow_id': u'39a0a055-68f9-439c-8475-7ecde31af63f', u'id': u'fca02cf9-e359-4f15-8399-f87fed8f5b51', u'state_info': u"Failure caused by error in tasks: task1\n\n task1 [task_ex_id=a9cfeda0-d8ee-4f00-bddf-d807a12ab25d] -> {status: 404, cookies: {}, encoding: None, url: http://127.0.0.1/api/v1/executions, elapsed: 0.006918, content: {u'faultstring': u'The resource could not be found.'}, headers: {u'Content-Length': u'57', u'Access-Control-Allow-Headers': u'Content-Type,Authorization,X-Auth-Token,St2-Api-Key,X-Request-ID', u'Access-Control-Expose-Headers': u'Content-Type,X-Limit,X-Total-Count,X-Request-ID', u'X-Request-ID': u'015a26a0-512d-4570-9706-e85736050037'