This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![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 { |
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
- 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
Steam chat, the thing you use while playing games, mangles your messages for you... It's especially interesting when sending shell commands.
~/.ssh/config
becomeshttp://ssh/config
$HOME/.ssh/config
becomeshttp://HOME/.ssh/config
${HOME}/.ssh/config
becomeshttp://HOME}/.ssh/config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
NewerOlder