View xanmod-install.sh
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 | |
set -e | |
for field in $(cat /proc/cmdline); do | |
if [[ "${field}" = root=* ]]; then | |
UUID=$(echo $field | awk -F= '{print $3}') | |
break | |
fi | |
done |
View sources.list
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
deb mirror://mirrors.ubuntu.com/mirrors.txt/ focal restricted multiverse universe main | |
deb-src mirror://mirrors.ubuntu.com/mirrors.txt/ focal restricted multiverse universe main | |
deb mirror://mirrors.ubuntu.com/mirrors.txt/ focal-updates restricted multiverse universe main | |
deb-src mirror://mirrors.ubuntu.com/mirrors.txt/ focal-updates restricted multiverse universe main | |
deb mirror://mirrors.ubuntu.com/mirrors.txt/ focal-security restricted multiverse universe main | |
deb-src mirror://mirrors.ubuntu.com/mirrors.txt/ focal-security restricted multiverse universe main | |
deb mirror://mirrors.ubuntu.com/mirrors.txt/ focal-backports restricted multiverse universe main | |
deb-src mirror://mirrors.ubuntu.com/mirrors.txt/ focal-backports restricted multiverse universe main | |
deb mirror://mirrors.ubuntu.com/mirrors.txt/ focal-proposed restricted multiverse universe main | |
deb-src mirror://mirrors.ubuntu.com/mirrors.txt/ focal-proposed restricted multiverse universe main |
View install-fahclient-systemd.sh
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/sh | |
# Create a systemd service for the FAH client. | |
echo '[Unit] | |
Description=Folding@Home Client | |
After=network.target | |
[Service] | |
WorkingDirectory=/var/lib/fahclient | |
ExecStart=/usr/bin/FAHClient /etc/fahclient/config.xml --run-as fahclient --pid-file=/var/run/fahclient.pid |
View gist:ac1e84ed39205926d56c851d7f527168
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
### Keybase proof | |
I hereby claim: | |
* I am mmstick on github. | |
* I am mmstick (https://keybase.io/mmstick) on keybase. | |
* I have a public key ASB9fnv3gH4sQQcdnvwt7jGb-dD3HoKQNjSGkLU-MxdR4wo | |
To claim this, I am signing this object: |
View distinst.h
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
#ifndef distinst_h | |
#define distinst_h | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
typedef enum { | |
DISTINST_FILE_SYSTEM_TYPE_NONE = 0, | |
DISTINST_FILE_SYSTEM_TYPE_BTRFS = 1, |
View 01-main.c
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 <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <errno.h> | |
#include <string.h> | |
/// A fat pointer which points to byte array of text. | |
typedef struct str { | |
uint8_t *data; | |
size_t len; |
View paths.rs
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
/// Takes a pathname and shortens it for readability. | |
pub fn shorten_path(path: &Path) -> PathBuf { | |
// Attempt to strip the current working directory from the path. | |
path.strip_prefix(&env::current_dir().unwrap()) | |
// If the home directory was split, return a new `PathBuf` with "." as the replacement. | |
.map(|value| PathBuf::from(".").join(value)) | |
// If the current working directory could not be found, attempt to strip the home directory from the path. | |
.unwrap_or(path.strip_prefix(&env::home_dir().unwrap()).ok() | |
// Return the input path if the home directory was not found, otherwise prepend "~" to the path. | |
.map_or_else(|| path.to_path_buf(), |value| PathBuf::from("~").join(value))) |
View bank.rs
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
use std::io::{stdin, stdout, BufRead, Error, Write}; | |
use std::fmt::{self, Display}; | |
fn main() { | |
// Create the account that we will emulate | |
let mut account = Account::new(); | |
// Print the first input message to the screen | |
print!("Enter your account name: "); | |
let stdout = stdout(); |
View split.rs
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
use std::io::{self, BufRead, BufReader, Write}; | |
use std::time::Instant; | |
fn main() { | |
// Obtain a buffered handle to standard input | |
let stdin = io::stdin(); | |
let mut stdin = BufReader::new(stdin.lock()); | |
// Mark the current time for a later duration comparison. | |
let start = Instant::now(); |
NewerOlder