Skip to content

Instantly share code, notes, and snippets.

View ligurio's full-sized avatar
💥

Sergey Bronnikov ligurio

💥
View GitHub Profile
@Hirrolot
Hirrolot / CoC.ml
Last active April 5, 2024 15:34
How to implement dependent types in 80 lines of code
type term =
| Lam of (term -> term)
| Pi of term * (term -> term)
| Appl of term * term
| Ann of term * term
| FreeVar of int
| Star
| Box
let unfurl lvl f = f (FreeVar lvl)
@Alex4386
Alex4386 / crossover-howtocompile.md
Last active April 9, 2024 09:09
CodeWeavers CrossOver - How to compile from source! for macOS

[STOP] This gist is deprecated.

TL;DR

WAY MORE UP-TO-DATE GIST (and includes some setup stuff that I forgot to document): https://gist.github.com/sarimarton/471e9ff8046cc746f6ecb8340f942647
Current Development for Building Libre-version of CrossOver: https://github.com/GabLeRoux/macos-crossover-cloud-build.
For Latest Discussions: https://github.com/GabLeRoux/macos-crossover-cloud-build/issues.

Long Description

This version of gist is outdated since it was written while I was compiling CrossOver v19. and seems to be there are some breaking changes in v19.1+ and 20. Also, I think I missed some required libraries/stub files that was required in build (that I previously installed beforehand). Oops.

//
// Simplified model of the MongoDB Raft consensus algorithm in Promela.
//
// The number of servers.
#define N 3
#define Quorum 2
// State constraints.
theory
Consensus_Demo
imports
Network
begin
datatype 'val msg
= Propose 'val
| Accept 'val
@bessarabov
bessarabov / gist:674ea13c77fc8128f24b5e3f53b7f094
Last active March 27, 2024 07:46
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@MattPD
MattPD / analysis.draft.md
Last active May 4, 2024 14:56
Program Analysis Resources (WIP draft)
@DavidBuchanan314
DavidBuchanan314 / cursed_mandelbrot.c
Last active June 28, 2023 15:12
Compile-time mandelbrot in pure C. Outputs a PGM image file to stdout. Output can be seen at https://twitter.com/David3141593/status/1062468528115200001
#include <stdio.h>
#define SQ(x) (x)*(x)
#define M0(x,y) SQ(x)+SQ(y)<4?0:0xe0
#define M1(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M0(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0)):0xc0
#define M2(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M1(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0xa0
#define M3(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M2(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x80
#define M4(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M3(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x60
#define M5(x,y,x0,y0) (SQ(x)+SQ(y)<4)?M4(SQ(x)-SQ(y)+(x0),2*(x)*(y)+(y0),x0,y0):0x40
---------------------------------------------------------------------------------------
Language files blank comment code
---------------------------------------------------------------------------------------
C 16045 1151514 1394479 6409501
C++ 9027 380730 428645 2129520
C/C++ Header 12480 401032 766593 2026578
Perl 4122 157859 208622 982209
HTML 903 33457 6243 471775
Bourne Shell 1298 62248 76580 469701
Markdown 259 46737 0 402916
@PurpleBooth
PurpleBooth / Dockerfile
Last active March 21, 2024 09:33
Create a static binary in go and put it in a from scratch docker container
FROM golang:1.9
WORKDIR /go/src/github.com/purplebooth/example
COPY . .
RUN go build -ldflags "-linkmode external -extldflags -static" -a main.go
FROM scratch
COPY --from=0 /go/src/github.com/purplebooth/example/main /main
CMD ["/main"]