Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- use_module(library(pairs)). | |
:- use_module(library(reif)). | |
not_in_list(K, L) :- | |
if_((L = []), | |
true, | |
([X | More] = L, | |
dif(K, X), | |
not_in_list(K, More))). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# install kubeclient and websocket-client-simple gems | |
# | |
# this is an example extending Kubeclient::Client with an get_pod_exec method | |
# | |
# it's just a POC | |
# I did run a pod with `kubectl -n kube-system run --tty --stdin --image=debian:buster-slim kubeclient` | |
# installed base ruby and required gems like: | |
# `apt-get update && apt-get install -y ruby ruby-dev build-essential && gem install --no-ri --no-rdoc kubeclient websocket-client-simple` | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
silly gist hack, why do we need you? :( |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
- There are always 24 hours in a day.
- February is always 28 days long.
- Any 24-hour period will always begin and end in the same day (or week, or month).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {run} from '@cycle/run'; | |
import {makeCanvasDriver, rect, text} from 'cycle-canvas'; | |
import { makeKeyboardDriver } from 'cycle-keyboard' | |
import onionify from 'cycle-onionify'; | |
import {makeCollection} from 'cycle-onionify'; | |
import isolate from '@cycle/isolate' | |
import xs from 'xstream' | |
import fromEvent from 'xstream/extra/fromEvent' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# memusg -- Measure memory usage of processes | |
# Usage: memusg COMMAND [ARGS]... | |
# | |
# Author: Jaeho Shin <netj@sparcs.org> | |
# Created: 2010-08-16 | |
############################################################################ | |
# Copyright 2010 Jaeho Shin. # | |
# # | |
# Licensed under the Apache License, Version 2.0 (the "License"); # |
Based on an example for Elvish.
From comment posted to HN:
I love the structured pipes, but as mentioned in another discussion, replacing the shell is a big leap for a lot of people. And you can get quite far without it with tools like "jq". And when I saw this, I just had to tinker a bit to see what I could do with Ruby, based on the example on the homepage:
$ curl -s https://api.github.com/repos/elves/elvish/issues | jr 'each{|issue| puts "#{issue["number"]}: #{issue["title"]}"} ' | head -n 11
Or (I expect pitchforks when you see the implementation for this):
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Open a series of web browsers with the list of PRs slated to review in various Github repositories. | |
# See _main function at the end. | |
CLIENT_KEY= | |
CLIENT_SECRET= | |
function get_command() | |
{ |
NewerOlder