Skip to content

Instantly share code, notes, and snippets.

View peschkaj's full-sized avatar

Jeremiah Peschka peschkaj

View GitHub Profile
@peschkaj
peschkaj / chocolatey.txt
Last active September 23, 2020 17:13
New Win10 Set Up
choco install sudo -y
choco install GoogleChrome -y
choco install firefox -y
choco install git -y
choco install adobereader -y
choco install powertoys -y
choco install vscode -y
choco install slack -y
choco install discord -y
choco install steam -y
@peschkaj
peschkaj / backtrace.txt
Created August 30, 2018 15:17
Output from M-x toggle-debug-on-quit after quitting during prompt for GitHub password
Debugger entered--Lisp error: (quit)
read-string("GitHub password: " nil t nil)
#f(compiled-function (prompt &optional confirm default) "Read a password, prompting with PROMPT, and return it.\nIf optional CONFIRM is non-nil, read the password twice to make sure.\nOptional DEFAULT is a default password to use instead of empty input.\n\nThis function echoes `.' for each character that the user types.\nYou could let-bind `read-hide-char' to another hiding character, though.\n\nOnce the caller uses the password, it can erase the password\nby doing (clear-string STRING)." #<bytecode 0x400857bf>)("GitHub password: ")
apply(#f(compiled-function (prompt &optional confirm default) "Read a password, prompting with PROMPT, and return it.\nIf optional CONFIRM is non-nil, read the password twice to make sure.\nOptional DEFAULT is a default password to use instead of empty input.\n\nThis function echoes `.' for each character that the user types.\nYou could let-bind `read-hide-char' to another hiding character, thoug
@peschkaj
peschkaj / xor_finder.c
Last active April 16, 2018 04:43
Finds the missing element in an array using xor
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
//#define DEBUG
#define POWER 8
#define MAX 256
fn translate(source: &str) -> String {
let m = build_map();
source
.to_lowercase()
.chars()
.filter(|c| c.is_alphanumeric())
.map(|c| if c.is_numeric() { c } else { m[&c] })
.collect::<Vec<char>>()
.chunks(5)
@peschkaj
peschkaj / time_sorts.rkt
Last active July 6, 2017 16:58
Time merge sort vs insertion sort
#lang racket
;; Generate a random list
;; n: list is length n
;; mx: maximum value to generate
(define (randomlist n mx)
(cond
[(= n 0) empty]
[else
(cons (+ 1 (random mx))
(randomlist (- n 1) mx))]))
@peschkaj
peschkaj / read_float.rs
Created June 12, 2017 22:06
Reads a float from STDIN, parses it, and then displays it on STDOUT
use std::f32;
use std::io::prelude::*;
fn main() {
print!("I need a float: ");
std::io::stdout().flush().ok().expect("Could not flush stdout");
let stdin = std::io::stdin();
let mut buf = String::new();
#include <iostream>
using namespace std;
class Monster {
public:
Monster();
Monster(int initial_hp);
~Monster();
void attack() const;
try {
Get-command -Name "git" -ErrorAction Stop >$null
Import-Module -Name "posh-git" -ErrorAction Stop >$null
$gitStatus = $true
} catch {
Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder."
$gitStatus = $false
}
function checkGit($Path) {
void get_user_action(char input[MAX_INPUT_LENGTH])
{
bool validInput = false;
do
{
cout << HAND_MSG << endl;
cin.get(input, MAX_INPUT_LENGTH, '\n');
cin.ignore(100, '\n');
s_to_lower(input);
#[test]
fn telemetry_cleanup_removes_old_files() {
setup(&|config| {
expect_ok(config, &["rustup", "default", "stable"]);
expect_ok(config, &["rustup", "telemetry", "on"]);
expect_ok(config, &["rustc", "--version"]);
let telemetry_dir = config.rustupdir.join("telemetry");
utils::ensure_dir_exists("telemetry",