Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremiah Peschka peschkaj

View GitHub Profile
@peschkaj
peschkaj / chocolatey.txt
Last active Sep 23, 2020
New Win10 Set Up
View chocolatey.txt
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 Aug 30, 2018
Output from M-x toggle-debug-on-quit after quitting during prompt for GitHub password
View backtrace.txt
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 Apr 16, 2018
Finds the missing element in an array using xor
View xor_finder.c
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
//#define DEBUG
#define POWER 8
#define MAX 256
View translate.rs
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 Jul 6, 2017
Time merge sort vs insertion sort
View time_sorts.rkt
#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 Jun 12, 2017
Reads a float from STDIN, parses it, and then displays it on STDOUT
View read_float.rs
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();
View 1.cpp
#include <iostream>
using namespace std;
class Monster {
public:
Monster();
Monster(int initial_hp);
~Monster();
void attack() const;
View git.ps1
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) {
View program02.cpp
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);
View delete-test.rs
#[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",