Skip to content

Instantly share code, notes, and snippets.

View jcchurch's full-sized avatar

James Church jcchurch

View GitHub Profile
@jcchurch
jcchurch / dierolling.py
Created October 12, 2022 02:38
My exploration of different die rolling stats for D&D and Risk.
print()
print()
print()
print("D&D")
totals = [0] * 19
for a in range(1, 7):
for b in range(1, 7):
for c in range(1, 7):
#include <unistd.h>
int main(v,c)
int v;
char **c;
{
for(v[(*&c)++]="Hello, world!\n)";
(!!!!c)[*c] && (v-- || --(*&c) && execlp(*c, *c, c[!!c] + !!c, !c));
**c = !c)
write(!!*c, **&c, !!**c);
class MyClass {
myVar: string = "Hello ";
greet(name: string) {
return this.myVar + name;
}
}
let x = new MyClass();
console.log(x.greet("James"));
let y = x.greet;
#!/usr/bin/env python3
import subprocess
import glob
import os
import os.path
import sys
def getProcessOutput(myCommand):
call = subprocess.Popen(myCommand, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
call.wait()
@jcchurch
jcchurch / buffon_needle.processing
Created March 14, 2019 20:35
Buffon's Needle Drop Experiment in Processing
int needles = 0;
int crossings = 0;
int needleLength = 50;
int linegap = 64;
int min = 0 + needleLength;
int max = width - needleLength;
void setup() {
size(640, 640);
//frameRate(5);
@jcchurch
jcchurch / configuration.nix
Created November 20, 2018 06:10
My configuration.nix before I gave up on using NixOS. May go back to it some day.
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6IvI3E/uvZOh1uQ+jh6K3M+MVMGrfQxaE+ygnkVvpDp4hl5/PyZ3HpDqSFEKVm7QDqpcD0MDK8KK69tNGfD0u9PxReFxKEbLOuir84XzlTdIzY0drX79WLpT7gFV5qZmFuC8YEQSpC8oLAbQXDPu1CTNFLqo1ojNLNNVIjufSm68VTYldWt3RP2UWwNq4U1UPYtNGtQjobSAN7SXAHLYkwfpBMVCwaJG0Hk+7xMKSU4jhMHTIAAi71rTzXvQV6Th7iS4shxZ/+ixMELxkmHB7Z2qKAlk7+snFLrWxNrQH6mU42Xa2e9A8ED2E6PF7SZrLkM9yQ9I6a3vlZE30oind4cQRJZYleuNQuYQPKL48qi6aP2fBH922uHr+99AfW+BA1MOvz8V1RCXz/XKes9cGlVG2YXzhXJK2mLBIclPfMnSXqCGxLRejpVBU4lFqAf1pxplj25SeBGVVujkVIi//Jt76vzb+8P3ohbsvAwWpeP79PEGoTD89YhiWgr/tQU+dxot/hn7ssfeXo7CLecUE9BNPvIj1BwbYunvNpdzYjjkx2ZVUer/1rkVhwtabFhi5ObrHgRcBgpIfnPu5pgOutvGGmn8bAK90PEnW4u+QbN7B5JjZHzVCAUaBdCbwd2Wd295lsSB4w8mFPtWv0yuxgvABg/1NfoQ9iPr/TvNRiQ== [email protected]
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDahvasRpkyRRTaoDJFIOu5tReX0puC93+acjWrj47t8oHrIu30+w0d9MwPBpc1ZkWx+WkLHrVZ6c8Zifdl8qA0kzSbc9AoFcGtTAO+cubjdWfIT0Db7G9KQY8jmumSuVDJ6Bwr/urpB543FxLnaDMMm3VGXwIEXtfUag6OTXvHIrZvBeZ9QQvInhMBF/1kWxcPqaCXv/uh3oHjtc3BgMe04hMBwuQaaxnpwvcKsCW1bE01zQxU
@jcchurch
jcchurch / ieee754.py
Last active September 18, 2018 06:43
"""
This program demonstrates how to convert
floating-point numbers to IEEE 754 standard.
Set the "data_type" variable at the beginning
to either "double" or "float" to test how the
numbers are arranged differently under each type.
"""
@jcchurch
jcchurch / peggame.cpp
Created July 22, 2018 12:58
Solves the Cracker Barrell peg game.
#include <iostream>
#include <vector>
const int HOLES = 15;
const int MOVES = 18;
const int JUMP = 3;
bool play(int pegs[], int board[][JUMP], int remaining, std::vector<int>& moves) {
if (remaining == 1) {
@jcchurch
jcchurch / makeGraph.py
Last active April 18, 2018 15:53
Generates the edge list for a randomly generated graph. The first value presented is the number of verticies in the graph. The second is the number of edges. Every triplet of values after that represents an edge consisting of a source vertex, a destination vertex, and the weight of that edge.
#!/usr/bin/env python3
"""
Generates the edge list for a randomly generated graph.
- The first value presented is the number of verticies in the graph.
- The second is the number of edges.
- Every triplet of values after that represents an edge consisting of a source vertex,
a destination vertex, and the weight of that edge.