Skip to content

Instantly share code, notes, and snippets.

View servinagrero's full-sized avatar

Sergio Vinagrero servinagrero

View GitHub Profile
@jiacai2050
jiacai2050 / tree.zig
Last active April 24, 2023 15:10
Tree(1) in Zig
//! Tree(1) in Zig
//! https://linux.die.net/man/1/tree
const std = @import("std");
const process = std.process;
const fs = std.fs;
const mem = std.mem;
const testing = std.testing;
const VisitedEntry = struct {
@gillescastel
gillescastel / Phd workflow.md
Last active August 24, 2025 02:48
Phd Workflow

Directory structure:

.
├── papers
│   ├── Title - Author.pdf
│   └── Title - Author.pdf
├── notes
│   ├── 2022-04-10
│   │   ├── note.tex
@daaronr
daaronr / bookdown_to_quarto.md
Last active December 22, 2022 20:00
going from Bookdown (rethinkpriorities package or Reinstein's bookdowns) to Quarto books

Bookdown to Quarto -- steps and considerations

#rstats I think I'll switch to Quarto. It seems it can do all Bookdown can do & more, with better support.

- Anyone know tools/templates for converting projects from Rmd/Bookdown to Quarto?
- Am I losing something from making the switch?

@xieyihui

— 𝙳𝚊𝚟𝚒𝚍 𝚁𝚎𝚒𝚗𝚜𝚝𝚎𝚒𝚗 (@GivingTools) March 30, 2022

At Rethink we set up this template and tools.

For much of my work I was using the Bookdown style and template I worked on here

But I think I am (and we are) moving to Quarto. ... Quarto pages and Quart

@jackdbd
jackdbd / xcb.zig
Last active January 18, 2024 14:29 — forked from NBonaparte/xcb.zig
Minimal XCB + Cairo example in Zig
//! Minimal XCB + Cairo example in Zig
//! Dependencies: libc, xcb, cairo
//! install XCB development files
//! sudo apt-get install libxcb1-dev
//! install cairo development files
//! sudo apt-get install libcairo2-dev
//! build and run with:
//! zig build-exe xcb.zig -lc -lxcb -lcairo && ./xcb
const std = @import("std");
const c = @cImport({
@melvic-ybanez
melvic-ybanez / what-i-didnt-know-about-fp-2020.md
Last active August 1, 2024 08:25
What I Didn't Know about Functional Programming until 2020

What I Didn't Know about Functional Programming until 2020

  1. Programming using a series of transformations and aggregations, something I've been doing for years, is known as programming in the map/reduce style.
  2. The more abstract the type is, the greater its cardinality, and the smaller the set of operations it supports. So make use of universal quantifiers, particularly by implementing fully parametric functions. They guide you on how to implement their term-level definitions by narrowing down the number of possible implementations. In other words, the type system of Scala (or Haskell, for that matter) is not only great for capturing compile-time errors, but is also capable of leading you to the correct solution.
  3. You can encode union types by combining different Scala features such as type constructors, subtyping and implicits, and by taking advantage of the Curry-Howard Isomorphism and De Morgan's Laws for neg
@mmzsource
mmzsource / cljs-quil-emacs-figwheel-setup.md
Last active August 11, 2023 00:43
Setup dynamic Clojurescript and Quil environment with emacs and figwheel

My environment

  • emacs 26.3
  • cider 0.25.0
  • leiningen 2.9.4 on Java 11.0.2
  • ~/.lein/profiles.clj : {:user {:plugins []}}

Project setup

In a terminal, run these commands:

@anton-christensen
anton-christensen / polyhedra.conky
Created April 20, 2018 23:45
Polyhedra conky script
conky.config = {
_update_interval=0.03,
update_interval=0.075,
background=false,
text_buffer_size=2048,
double_buffer=true,
no_buffers=true,
use_xft=true,
font='Inconsolata',
draw_shades=false,
@lbruder
lbruder / lbForth.c
Created April 6, 2014 15:21
A minimal Forth compiler in ANSI C
/*******************************************************************************
*
* A minimal Forth compiler in C
* By Leif Bruder <leifbruder@gmail.com> http://defineanswer42.wordpress.com
* Release 2014-04-04
*
* Based on Richard W.M. Jones' excellent Jonesforth sources/tutorial
*
* PUBLIC DOMAIN
*
@eliben
eliben / gist:5797351
Created June 17, 2013 14:36
Generic regex-based lexer in Python
#-------------------------------------------------------------------------------
# lexer.py
#
# A generic regex-based Lexer/tokenizer tool.
# See the if __main__ section in the bottom for an example.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
# Last modified: August 2010
#-------------------------------------------------------------------------------
@jboner
jboner / latency.txt
Last active November 14, 2025 11:14
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD