Skip to content

Instantly share code, notes, and snippets.

View gcr's full-sized avatar

Kimmy gcr

  • Google AI
  • 18:49 (UTC -04:00)
View GitHub Profile
int k;
double sin() ,cos();
main(){
float A=0, B=0, i, j, z[1760];
char b[1760];
printf("\x1b[2J");
for(; ; ) {
memset(b,32,1760);
memset(z,0,7040);
for(j=0; 6.28>j; j+=0.07) {
@gcr
gcr / donut.jq.md
Last active April 12, 2024 14:08

donut.c, but it's in jq

Run this in your terminal:

                  jq -nr 'def R(A;B;C
            ):range(A;B;C);def R(A):range
          (A);30as$s|1as$R1|2as$R2|7as$K2|(
        $s*$K2*3/(8*($R1+$R2)))as$K1|def t($A;$B
     ):($A|cos)as$cA|($B|cos)as$cB|($A|sin)as$sA|($B

Recovering corrupt files from a failing Raspberry Pi SD card

Yesterday night, my RasPi wouldn’t boot (black screen). It’s an SD card issue: macOS reports I/O timeouts, so something’s clearly going wrong.

Rescue what parts of the filesystem we can

First, we can use ddrescue to gather all of the blocks:

sudo ddrescue -vv -n /dev/rdisk4 sd-card.img sd-card.img.ddrescue-map-2

The default configuration is to read 128 sectors of 512 bytes each per read() call, ad if any fail, to skip 128 sectors (64kb) ahead. This takes all night because each time reads something from a failing part of the card, MacOS takes 30 sec to I/O timeout, and I think this can’t be configured.

# Most of this was adapted from
# http://matt.might.net/articles/compiling-up-to-lambda-calculus/
# Python's lambda expressions are turing-complete. To show this, we will
# implement the "Lambda calculus" which is another way of saying "We're so manly
# we don't even NEED if statements!" The lambda calculus was invented in the
# 1930s, and it can solve any computable problem just by using anonymous
# functions that each take one argument and return one value, function
# application, and variable references. No jumps or GO TO's needed.
Org-mode entities
=================
* User-defined additions (variable org-entities-user)
* Letters
** Latin
Symbol Org entity LaTeX code HTML code
-----------------------------------------------------------
À \Agrave \`{A} À
#lang racket
(require parser-tools/yacc
parser-tools/lex
(prefix-in : parser-tools/lex-sre))
;; This implements a simple desk calculator in Racket.
;; Every calculator needs memory!
(define memory (make-parameter 0))
(define (mem-add! x)

THE NORTH STAR

FREDERICK DOUGLASS, M. R. DELANY, Editors

RIGHT IS OF NO SEX - TRUTH IS OF NO COLOR - GOD IS THE FATHER OF US ALL, AND ALL WE ARE BRETHEREN

WILLIAM C. NEIL, Publisher JOHN DICK, Printer


# 🌟 #
jq\
-rn '"ggEDC
grrggEDCarraaFEDbrrr
GGFDErrrEEErEEErEGCDE"|gsub
("\\s";"")|explode|.[]as$note
|"rg.a.bC
.D.EF.G.A.BC"|gsub
("\\s";"")|explode|index