Skip to content

Instantly share code, notes, and snippets.

View ceving's full-sized avatar
💭
Ejaculating

ceving

💭
Ejaculating
View GitHub Profile
;; Closure-Creating Interpreters in Racket
#lang racket
;; expressions comprise the λ-calculus extended
;; to include numeric constants and the + builtin
(define (expr? e)
(match e
[(? number? n) #t]
[`(+ ,(? expr? e0) ,(? expr? e1)) #t]
[(? symbol? x) #t]
@thefloodshark
thefloodshark / .js
Created April 2, 2018 07:36
Tampermonkey Userscript - Website Auto-Refresh Timer
// ==UserScript==
// @name Auto-Refresh
// @include https://www.example.com
// ==/UserScript==
//--- https://stackoverflow.com/questions/25484978/i-want-a-simple-greasemonkey-script-to-reload-the-page-every-minute
setTimeout(function(){ location.reload(); }, 20*1000);
@kvaps
kvaps / grub.cfg
Created January 18, 2018 15:38
Grub config for EFI and PXE boot
set timeout=3
menuentry 'Linux diskless' --class os {
insmod efi_gop
insmod efi_uga
# set server from option 66 (tftp-server-name) if not exist, use next_server
if ! net_get_dhcp_option net_default_server ${net_default_interface} 66 string; then
echo ' using next_server option instead.'
@ktakashi
ktakashi / cps.scm
Created April 29, 2016 12:26
CPS conversion
;; expression must already be expanded by expander
;; so it shall only have the following syntaxes:
;; - define
;; - lambda
;; - set!
;; - quote
;; - if
;; - begin
;; NB: by this point, all of the optimisation in Scheme level
;; must be done. (e.g. constant folding)
@samhocevar
samhocevar / gist:00eec26d9e9988d080ac
Last active January 13, 2024 23:40
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <sam@hocevar.net>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
#
@denji
denji / golang-tls.md
Last active April 29, 2024 03:39 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@rothgar
rothgar / main.yml
Last active March 8, 2024 07:16
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
@james-d
james-d / AnimationTimerTest.java
Last active May 28, 2023 08:02
Experiment to see how smooth animation is in JavaFX using an AnimationTimer to update the view on each pulse. This simulates 300 balls of various sizes bouncing (with perfect elasticity) off each other and the edges of the Pane in which they're contained. It could easily be extended to a simulation where the pressure on each wall was measured by…
import static java.lang.Math.PI;
import static java.lang.Math.cos;
import static java.lang.Math.sin;
import static java.lang.Math.sqrt;
import static javafx.scene.paint.Color.BLACK;
import static javafx.scene.paint.Color.BLUE;
import static javafx.scene.paint.Color.BROWN;
import static javafx.scene.paint.Color.GREEN;
import static javafx.scene.paint.Color.PINK;
import static javafx.scene.paint.Color.RED;
@rickhull
rickhull / .emacs
Last active January 27, 2016 09:33
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; use setq-default so modes that want tabs can enable this
(setq-default indent-tabs-mode nil)
(defun rick-sh-mode ()
"2 space indent"
(interactive)
(setq sh-basic-offset 2
sh-indentation 2))
(add-hook 'sh-mode-hook 'rick-sh-mode)