Skip to content

Instantly share code, notes, and snippets.

View cben's full-sized avatar

Beni Cherniavsky-Paskin cben

View GitHub Profile
@rougier
rougier / tag.el
Last active May 29, 2024 15:51
Rounded boxed tags for Emacs
;; ---------------------------------------------------------------------
;; Tag minor mode
;; Copyright (C) 2020 Nicolas .P Rougier
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
@aphyr
aphyr / minikanren.pl
Created October 12, 2020 22:10
Minikanren in Lisp in Prolog
:- 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))).
@onlurking
onlurking / programming-as-theory-building.md
Last active December 9, 2024 03:20
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

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

Always Already Programming

Everyone who interacts with computers has in important ways always already been programming them.

Every time you make a folder or rename a file on your computer, the actions you take through moving your mouse and clicking on buttons, translate into text-based commands or scripts which eventually translate into binary.

Why are the common conceptions of programmer and user so divorced from each other? The distinction between programmer and user is reinforced and maintained by a tech industry that benefits from a population rendered computationally passive. If we accept and adopt the role of less agency, we then make it harder for ourselves to come into more agency.

We've unpacked the "user" a little, now let's look at the "programmer." When a programmer is writing javascript, they are using prewritten, packaged functions and variables in order to carry out the actions they want their code to do. In this way, the programmer is also the user. Why is using pre-made scripts seen

@steigr
steigr / kubeclient-exec.rb
Last active October 25, 2021 10:58
Running commands inside pods
#!/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`
#
@Brainiarc7
Brainiarc7 / fix-intel_wifi_aer-avell_g1513_fire_v3
Created July 16, 2018 13:21 — forked from flisboac/ fix-intel_wifi_aer-avell_g1513_fire_v3
Temporary fix for AER's excessive `severity=Corrected` logging for Intel Wireless (Avell G1513 Fire V3) (Arch Linux)
silly gist hack, why do we need you? :(
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active December 23, 2024 03:14
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

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.

Falsehoods

  • 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).
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'
@Ladas
Ladas / memusg
Created July 21, 2017 12:02
refresh quick perf test, run as ./memusg bundle exec rails r qe_ocp_refresh_manager_first_refresh.rb <ems_name>, grep evm.log for :save_inventory to get a time
#!/usr/bin/env bash
# memusg -- Measure memory usage of processes
# Usage: memusg COMMAND [ARGS]...
#
# Author: Jaeho Shin <[email protected]>
# Created: 2010-08-16
############################################################################
# Copyright 2010 Jaeho Shin. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
@vidarh
vidarh / README.md
Last active July 9, 2017 16:25
Stupid / simple JSON command line processing with Ruby

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):