Skip to content

Instantly share code, notes, and snippets.

@munificent
munificent / generate.c
Last active May 14, 2024 05:30
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
anonymous
anonymous / main.rs
Created January 6, 2017 20:23
#![feature(non_ascii_idents)]
fn main() {
std::env::args().nth(1)
.ok_or(format!("Usage: {} FILE", std::env::args().next().unwrap())) // File name
.and_then(|filename| {
std::fs::File::open(&filename)
.map_err(|e| (&e as &std::error::Error).description().to_string())
}).map(|f| (f, String::new()))
.map(|(mut f, mut s)| ((&mut f as &mut std::io::Read).read_to_string(&mut s), s))
anonymous
anonymous / main.rs
Created January 6, 2017 20:23
#![feature(non_ascii_idents)]
use std::io::{Write, BufRead, BufReader};
use std::process::exit;
use std::fs::File;
fn main() {
let args : Vec<_> = std::env::args().collect();
if args.len() != 2 {
@drkarl
drkarl / gpgmutt.md
Created December 12, 2016 14:38 — forked from bnagy/gpgmutt.md
Mutt, Gmail and GPG

GPG / Mutt / Gmail

About

This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.

Here is an incomplete list of things that are different from other approaches:

  • I don't use keyservers. Ever.
  • Yes, I use Gmail instead of some bespoke hipster freedom service
@brock
brock / README.md
Last active May 10, 2016 18:26
Life Pro Tip for using Rsync
  • Be me
  • forget the exact syntax for using rsync.
  • get nested folders by mistake or end up with lots of files in the current directory
  • sync files then delete files like 100 times as you try to remember the syntax
  • look at the man page and then try again
  • get nested folders by mistake or end up with lots of files in the current directory
  • sync files then delete files like 100 times as you try to remember the syntax
  • finally figure it out

@SoniEx2
SoniEx2 / steamchat.md
Created April 26, 2016 23:14
Steam Chat

Did you know?

Steam chat, the thing you use while playing games, mangles your messages for you... It's especially interesting when sending shell commands.

  • ~/.ssh/config becomes http://ssh/config
  • $HOME/.ssh/config becomes http://HOME/.ssh/config
  • ${HOME}/.ssh/config becomes http://HOME}/.ssh/config
@PurpleBooth
PurpleBooth / README-Template.md
Last active July 25, 2024 13:33
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@CMCDragonkai
CMCDragonkai / higher_kinded_types_in_rust_and_haskell.md
Last active July 10, 2024 12:38
Rust/Haskell: Higher-Kinded Types (HKT)

Rust/Haskell: Higher-Kinded Types (HKT)

A higher kinded type is a concept that reifies a type constructor as an actual type.

A type constructor can be thought of in these analogies:

  • like a function in the type universe
  • as a type with a "hole" in it
@SurealCereal
SurealCereal / bootgui
Created June 19, 2015 13:30
Bash script to enable/disable the GUI on boot for Ubuntu Mate. Tested on Ubuntu Mate 15.04 on a Raspberry Pi 2 B.
#!/bin/bash
# Call with either enable or disable as first parameter
if [[ "$1" == 'enable' || "$1" == 'disable' ]]; then
sudo systemctl set-default multi-user.target --force
sudo systemctl $1 lightdm.service --force
sudo systemctl $1 graphical.target --force
sudo systemctl $1 plymouth.service --force
else
echo Call with either "enable" or "disable" as first parameter.
fi