Skip to content

Instantly share code, notes, and snippets.

Jeremiah Peschka peschkaj

Block or report user

Report or block peschkaj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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",
View convert-01.sql
CREATE TABLE conversion (
from VARCHAR(50) NOT NULL ,
to VARCHAR(50) NOT NULL ,
conversion_factor DECIMAL (38, 10) NOT NULL
) ;
ALTER TABLE conversion
ADD CONSTRAINT pk_conversion
PRIMARY KEY (from, to) ;
You can’t perform that action at this time.