Skip to content

Instantly share code, notes, and snippets.

View jnorthrup's full-sized avatar

Jim Northrup jnorthrup

View GitHub Profile
@jnorthrup
jnorthrup / letsencrypt-jetty-auto.sh
Created February 15, 2019 03:50 — forked from smiley-yoyo/letsencrypt-jetty-auto.sh
How to use Letsencrypt certificate & private key with Jetty
#!/usr/bin/env bash
if [ ! -n "$1" ]; then
echo "usage: letsencrypt-jetty-auto.sh your_password_here"
exit 1
fi
# input: fullchain.pem and privkey.pem as generated by the "letsencrypt-auto" script when run with
# the "auth" aka "certonly" subcommand
<html>
<head/>
<?php
?>
<body>
<?php
$_BLOCKCHAIND = "~/stackbitd";
$qry = [];
parse_str($_SERVER['QUERY_STRING'], $qry);
@jnorthrup
jnorthrup / Parser.kt
Created August 14, 2017 18:32 — forked from absurdhero/Parser.kt
monadic parser combinator in Kotlin
package net.raboof.parser
// based on http://blogs.msdn.com/b/lukeh/archive/2007/08/19/monadic-parser-combinators-using-c-3-0.aspx
data class Result<TInput, TValue>(val value: TValue, val rest: TInput)
class Parser<TInput, TValue>(val f: (TInput) -> Result<TInput, TValue>?) {
operator fun invoke(input: TInput): Result<TInput, TValue>? = f(input)
infix fun or(other: Parser<TInput, TValue>): Parser<TInput, TValue> {
nar.input("goal:{health}! :|: %1.0;0.95%");
[05:32] sseehh__ nar.believe("goal:{health}", Tense.Present, 0.5f, 0.9f); //reset
[05:33] sseehh__ this is a more clear way to specify the goals by using a set
[05:33] sseehh__ this way it has an unambiguous way to represent combinations of them
[05:33] sseehh__ so different missions can be toggled or combined
[05:33] sseehh__ like in an RTS
[05:34] sseehh__ nar.input("goal:{food}! :|:");
[05:34] sseehh__ nar.input("goal:{food}. :|: %0.5;0.90%"); //reset
I wanted to blog this small hack while it was still fresh in my head. I am using this to define and fine-tune a postgresql database prior to loading up the data (seperate scripts for another post perhaps)
from a bash commandline paste in:
function m2m () {
for i in $@;
do
echo "create table $i (id bigserial primary key , meta xml );";
done;
echo "create table $1_$2 ($1 bigint references $1, $2 bigint references $2, primary key ($1,$2 )); "
root@kubuntu:/tmp/sbin# ./btrfs balance start --force -dconvert=single -mconvert=dup -v /tmp/2/
Dumping filters: flags 0xf, state 0x0, force is on
DATA (flags 0x100): converting, target=281474976710656, soft is off
METADATA (flags 0x100): converting, target=32, soft is off
SYSTEM (flags 0x100): converting, target=32, soft is off
ERROR: error during balancing '/tmp/2/' - Invalid argument
There may be more info in syslog - try dmesg | tail
root@kubuntu:/tmp/sbin# uname -a
Linux kubuntu 3.16.0-30-generic #40~14.04.1-Ubuntu SMP Thu Jan 15 17:43:14 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
root@kubuntu:/tmp/sbin#
package hacks;
import bbcursive.Cursive;
import bbcursive.std;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
@jnorthrup
jnorthrup / Narsive.java
Created June 14, 2015 02:25
conceptual narsese grammar
package hacks;
import bbcursive.Cursive;
import bbcursive.std;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
{"cv": [
"Alerts",
{ "id": "Reports", "section": "Reports", "icon": "fa fa-bullhorn fa-fw"},
{ "layer": "cvr01", "tree": true, "kml": "http://climateviewer.com/kml/cv-reports/CV-Reports-October-2014-Climate-Viewer-3D.kmz", "source": "Climate Viewer Reports", "sourceURL": "https://climateviewer.crowdmap.com/", "name": "CV Reports - 2011 thru present"},
{ "id": "Carbon_Capture_Report", "section": "Carbon Capture Report (news)", "icon": "fa fa-newspaper-o fa-fw"},
{ "layer": "ccr01", "kml": "http://climatechange.carboncapturereport.org/cgi-bin/dailyreport_kml?DATE=&r=85147090.2500438&type=2", "source": "CarbonCaptureReport.org", "sourceURL": "http://climatechange.carboncapturereport.org/cgi-bin/topic?", "name": "Climate Change"},
{ "layer": "ccr02", "kml": "http://ccs.carboncapturereport.org/cgi-bin/dailyreport_kml?DATE=&r=1070538004.90345&type=2", "source": "CarbonCaptureReport.org", "sourceURL": "http://ccs.carboncapturereport.org/cgi-bin/topic?", "name": "Carbon Capture/Sequestration"},
{ "lay
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:beans xmlns="http://camel.apache.org/schema/spring" xmlns:ns2="http://www.springframework.org/schema/beans" xmlns:ns3="http://www.springframework.org/schema/util" xmlns:ns4="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<ns2:description>beans::foo n2</ns2:description>
<ns3:map id="EnvData" scope="singleton" key-type="java.lang.String">
<ns2:description>Env data</ns2:description>
</ns3:map>
<ns3:map id="PIPdata" scope="prototype" key-type="java.lang.String">
<ns2:description>PIP data</ns2:description>
</ns3:map>
<routeContext id="n0">