Skip to content

Instantly share code, notes, and snippets.

View werediver's full-sized avatar
💭
🦀

Raman Fedaseyeu werediver

💭
🦀
View GitHub Profile
@benhoyt
benhoyt / markov.py
Created November 11, 2023 15:45
Generate text from an input using a simple Markov chain generator
import collections, random, sys, textwrap
# Build possibles table indexed by pair of prefix words (w1, w2)
w1 = w2 = ''
possibles = collections.defaultdict(list)
for line in sys.stdin:
for word in line.split():
possibles[w1, w2].append(word)
w1, w2 = w2, word
@9names
9names / 2serial4u.rs
Last active June 20, 2023 11:25
implementing 2 cdc serial ports on rp2040
//! # Pico USB Two Serial port Example
//!
//! Creates two USB Serial devices on a Pico board, with the USB driver running in
//! the main thread.
//!
//! This will create two USB Serial device echoing anything they receives.
//! On the first port incoming ASCII characters are converted to uppercase.
//! On the second port incoming ASCII characters are converted to lowercase.
//!
//! See the `Cargo.toml` file for Copyright and license details.
@emlun
emlun / README.md
Last active February 20, 2020 15:19
DRAFT: WebAuthn recovery credentials extension
@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 7, 2024 09:05
Swift Concurrency Manifesto
@Gankra
Gankra / OwnershipTLDR.md
Last active April 3, 2019 22:44
Swift Ownership Manifesto TL;DR

Swift Ownership Manifesto TL;DR

Most of the manifesto is background and detailed definitions -- if you're confused or want details, read the manifesto!

https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170213/032155.html

Note also that manifestos aren't complete proposals -- syntax and details may change!

One piece of background: inout is kinda complicated because it can be used on computed properties -- foo(&val.x) might be sugar for

@JoanTheSpark
JoanTheSpark / KiCAD_CopperSpiral_v2.py
Created November 27, 2015 08:54
v2 with spin direction and increasing amount of segments per turn for smoother result in outer circles
import sys, os
import shutil
import math
import itertools
from copy import deepcopy
# 0 1 2 3 4 5 6
LIST_elmt = [" ("," (start ",") (end ",") "," (layer ",") ","))"]
#LIST_elmt = [" (gr_line (start 131.571908 182.314571) (end 112.874456 120.68499) (angle 90) (layer Dwgs.User) (width 0.1))"]
#LIST_elmt = [" (segment (start 118.7 106.7) (end 119.4 106.7) (width 0.25) (layer B.Cu) (net 0))"]
Remove osxfuse if installed via homebrew:
> brew uninstall osxfuse
Install osxfuse binary and choose to install the MacFUSE compatibility layer:
http://sourceforge.net/projects/osxfuse/files/latest/download?source=files
Reboot (optional but recommended by osxfuse)
Install ntfs-3g via homebrew:
> brew update && brew install ntfs-3g
@JadenGeller
JadenGeller / Type Inference.c
Created April 29, 2015 03:27
C Type Inference (Let and Var)
#define let(name,value) const __typeof__ (value) name = value;
#define var(name,value) __typeof__ (value) name = value;
int main(int argc, char *argv[]) {
let(x,3); // const int x = 3;
var(y,5); // int y = 5;
printf("x:%i y:%i",x,y); // -> x:3 y:5
}
@bjorgvino
bjorgvino / yosemite ntfs read+write.txt
Last active December 2, 2021 03:58
osxfuse + ntfs-3g + Yosemite = NTFS R/W
Remove osxfuse if installed via homebrew:
> brew uninstall osxfuse
Install osxfuse binary and choose to install the MacFUSE compatibility layer:
http://sourceforge.net/projects/osxfuse/files/latest/download?source=files
Reboot (optional but recommended by osxfuse)
Install ntfs-3g via homebrew:
> brew update && brew install ntfs-3g