Skip to content

Instantly share code, notes, and snippets.

View linuskmr's full-sized avatar

Linus linuskmr

  • Germany
  • 22:24 (UTC +02:00)
View GitHub Profile
@linuskmr
linuskmr / ascii_tree.py
Created November 27, 2021 10:13
Single python function for generating ASCII trees
data = [
'Desktop',
('Downloads', [
'ubuntu.iso',
'abc.txt',
('photos', [
'001.jpg',
'002.jpg'
])
@hurryabit
hurryabit / stack_safe.rs
Last active December 25, 2021 17:43
Stack-safety for free?
// This gist contains the code from the blog post
// https://hurryabit.github.io/blog/stack-safety-for-free/
// We need Rust nightly to run the code.
#![feature(generators, generator_trait)]
use std::ops::{Generator, GeneratorState};
use std::pin::Pin;
fn triangular(n: u64) -> u64 {
if n == 0 {
0
@fnky
fnky / ANSI.md
Last active July 23, 2024 17:28
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone git@gist.github.com:<hash>.git     # or with ssh
@jlintz
jlintz / gist:1192247
Created September 4, 2011 04:19
Useful C debug macro
#ifdef DEBUG
#define _DEBUG(fmt, args...) printf("%s:%s:%d: "fmt, __FILE__, __FUNCTION__, __LINE__, args)
#else
#define _DEBUG(fmt, args...)
#endif