Skip to content

Instantly share code, notes, and snippets.

@jeremy-w
jeremy-w / blurb.fish
Created March 10, 2017 20:00
Fish function to create or reply to a social post on 10 Centuries. MPLv2
function blurb --description Post\ to\ 10C.\\nblurb\ post\ MESSAGE\\nblurb\ POST_ID\ REPLY --argument reply_id message
set -l token $TEN_CENTURIES_API_TOKEN
set -l endpoint https://api.10centuries.org/content/write
set -l usage 'blurb: post or reply to a message on 10C
Usage:
blurb post MESSAGE
Post a new blurb
//cc -Wextra -o build/dump-header-map dump-header-map.c
// see: https://github.com/llvm-mirror/clang/blob/release_40/include/clang/Lex/HeaderMapTypes.h
// https://github.com/llvm-mirror/clang/blob/release_40/include/clang/Lex/HeaderMap.h// https://github.com/llvm-mirror/clang/blob/release_40/lib/Lex/HeaderMap.cpp
// This is basically dump() from there.
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <err.h>
// pascal.c -- demonstrates effect of -fpascal-strings
// install -d build/ && cc -fpascal-strings pascal.c -o build/pascal
#include <stdio.h>
#include <string.h>
#include <vis.h>
static const char PascalString[] = "\pWirth";
static char VisifiedString[4 * (sizeof(PascalString) - sizeof('\0')) + sizeof('\0')];
int
@jeremy-w
jeremy-w / just a b64 url.txt
Created October 3, 2016 00:11
Editorial workflow to propose a filename for Markdown file based on first h1 and current date
editorial://add-workflow?workflow-data-b64=eNrNVdtqGzEQ_RWhUuhlY-zSp30JqZOmgbgxttNQmjZMpFlbZC0JXWIHs9Cv6Us_oW_5lH5JR7bXcRwKIQ8muy_izNHMnDNa7YwrYTTP-eBr96h98rm_s3d8fNE-HTSsHvKMgwjKaM_zbzNuIXr8gIVx2ItaKyLkBZQes0XoTIWRiaE_MhOKdcHBGAM6v2KJ6IMZD1QokSpSdlGCpzA_M-6qKM1kb17tEMOBVMG4AU4DT8nvMs14YUqJMoVObGLzvJmtgT20JQgcow6U-O_PX7yqsu313oEgRj0cxhLcwdQ69D71uCnC4RCnaRFubMoH8hq0WCggcjBXqHugh5jYFQEJz_mPF-fn_s2rxtvXnMBxqnXoTLQUam1XZ5_Gg1_AKbgk4qY8TWvaIo2IaRAXYZ4u49dQRnysbD5rZqxVEe1I2xj4nQ27pPX5iYXwBInvlhJfpu15p0OU2ft7mJQJa97DbuhZ92OH3ufoicbJU2dfG_PgDK2smBu-ZgLbugUY2qWylwac3HRgu41Qgk-n-w-mQNjc3Ueb3vrPB3f7e_f2DxPGKpQsGCZq2Y1EktHB6iZe_E6aVfU9q0_BR1ViWrLCmTHbp7Ex0JINlgOV6IVTy7ucd2PwDJiPQ2oqULmi3m00CyNkFgiui_8DX4Fgiw~~
@jeremy-w
jeremy-w / README.md
Last active February 26, 2016 03:48
hacking away at wxPython emoji handling

Test Files

  • test_gui.py: this can be run directly with Python; tries to set a wxStaticText to have as label an emoji
  • cocoa_gui.mm: this needs compiling with clang++; see the first line. This is a version of test_gui.py that cuts wxPython out of the equation to see if what we're seeing is a wxWidgets issue or a wxPython/Python issue.

Conclusions

I finished looking into issues with displaying emoji in wx labels under OS X.

@jeremy-w
jeremy-w / list-big-files.fish
Created November 19, 2015 21:02
fish script to list big files. Helpful in combating Massive View Controller.
function list-big-files --description 'list-big-files 250 swift dir/: list .swift files under dir having >250 lines'
set -l big_linecount 250
set -l extension swift
set -l root .
switch (count $argv)
case 0:
;
case 1:
set -l root $argv[0]
case 2:
@jeremy-w
jeremy-w / JWSParsing.hs
Last active October 17, 2015 03:52
Experimenting with using Text.Trifecta to provide rich error messages
-- An experiment in providing more useful error messages
-- when you validate a token after parsing it,
-- as for checking that a string represents a valid filename
-- in https://github.com/idris-lang/Idris-dev/pull/2728 .
--
-- Author: Jeremy W. Sherman (@jeremy-w)
-- Date: 2015-10-16
-- License: MPL v2.0
--
-- This Source Code Form is subject to the terms of the Mozilla Public License,
@jeremy-w
jeremy-w / SimpleElaborationExample.idr
Created October 9, 2015 17:24
Very basic example of using elaborator reflection to interactively fill in a hole in a function implementation.
-- Note that :elab does not automatically do :module Language.Reflection.Elab
-- for you. When you finish a proof, the same applies, so we have to also
-- add an import statement here, otherwise we'll get an error:
--
-- When checking right hand side of Main.shouldBeEmptyString:
-- No such variable Language.Reflection.Elab.Elab
import Language.Reflection.Elab
fillMeIn : List String -> String
fillMeIn strings =
@jeremy-w
jeremy-w / MysteriouslyUnreachableCase.idr
Created October 9, 2015 02:45
Demonstrates how trying to match against a runtime-determined value in a case seems to always pick that as the match
{-
> idris --execute MysteriouslyUnreachableCase.idr
MysteriouslyUnreachableCase.idr:17:10:warning - Unreachable case: case block in thingFromInt n rawA n
ok? False
-}
data Thing = A | AAAA
thingToInt : Thing -> Int
thingToInt thing =
@jeremy-w
jeremy-w / pipe.rs
Last active August 29, 2015 14:27
Implements Elixir's |> for Rust as pipe!.
/*
* Compile with:
* rustc -Z unstable-options --pretty expanded pipe.rs
*/
/* @file pipe.rs
* @author Jeremy W. Sherman (GitHub: @jeremy-w)
* @license ISC
*
* Implements and demonstrates use of the "pipe" (aka "thread-first") macro.
*/