Skip to content

Instantly share code, notes, and snippets.

View kevinbarbour's full-sized avatar
🍻

Kevin Barbour kevinbarbour

🍻
View GitHub Profile
// https://adventofcode.com/2022/day/3
/* ... */
fun part1(input: List<String>) =
input.sumOf {
it
.chunked(it.length / 2)
.map { ch -> ch.toSet() }
.let { sets -> sets[0].intersect(sets[1]) }
.map { ch -> ch.code }
// >= 97 assume lowercase, else assume uppercase
@kevinbarbour
kevinbarbour / docker-compose.yml
Created December 2, 2021 13:15
OctoPrint Docker Compose
version: '2.4'
services:
octoprint:
image: octoprint/octoprint
restart: unless-stopped
# devices:
# use `python -m serial.tools.miniterm` to see what the name is of the printer
# - /dev/ttyACM0:/dev/ttyACM0
# - /dev/video0:/dev/video0
#!/usr/bin/python
import urllib2
import re
import json
import datetime
def convertToFarenheit(celsius):
return (9.0/5.0 * celsius + 32)
data = urllib2.urlopen("https://water.weather.gov/ahps2/hydrograph_to_xml.php?gage=rmdv2&output=tabular&time_zone=edt").read(20000)

Keybase proof

I hereby claim:

  • I am barbourkd on github.
  • I am kevinbarbour (https://keybase.io/kevinbarbour) on keybase.
  • I have a public key ASC3U7nZarSxG5hGvehPm_jE0yuo1U55Si1bJUhqCW9vVgo

To claim this, I am signing this object:

{
"_id": ObjectId("546a35efa656319ce38209cc"),
"document": {
"filename": "dataassets/d0/f197001000003.txt",
"fields": [
{
"field": {
"datatype": "text",
"logicaltype": "id",
"name": "eventid",
static String popular(String user) throws FileNotFoundException, IOException {
String result = "";
File pop = new File("popular.txt");
Scanner pop_scanner = new Scanner(pop);
String pass;
while(pop_scanner.hasNext()) {
pass = pop_scanner.next();
System.out.println(pass);
module.exports = function(dir, ext, callback) {
ext = '.' + ext;
var result = [];
fs.readdir(dir, function(err, list) {
if(err) return callback(err);
list.forEach(function(file) {
if(path.extname(file) === ext)
result.push(file);
});
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
unsigned short extracted_op;
unsigned short opcode;
unsigned char memory[4096];
unsigned char V[16];
unsigned short I;
unsigned short pc;
@kevinbarbour
kevinbarbour / C4.java
Last active December 16, 2015 11:59
Connect 4 game using decision trees in java. WIP
// Kevin Barbour
// CMSC 401
// Program #5: Connect 4
// Program name: C4.java
import java.lang.Math;
import java.util.Scanner;
class Node {
final int MAXSCORE = 9999;
class Rat {
private int num, den;
Rat() {
num = 1;
den = 1;
}
Rat(int num, int den) {
this.num = num;