Skip to content

Instantly share code, notes, and snippets.

View nic-hartley's full-sized avatar
👀
Definitely working... I promise.

Nic Hartley nic-hartley

👀
Definitely working... I promise.
View GitHub Profile
@nic-hartley
nic-hartley / englishish.py
Last active March 20, 2021 01:54
Englishish generator
#!/usr/bin/env python3
"""
englishish.py is a quick-and-dirty prototype of a project I plan to work on
more later: A generator for text which obeys English spelling and grammar
rules, but whose output is nonsensical. The output of this script does tend
to make sense, but that's a product of the dictionary. If it was larger, it
would generate sentences which are grammatical but not sensical.
The next step is implementing this with a bigger dictionary, cleaner code, and
// TODO: Replace with real crypto
#[derive(Debug, Clone)]
pub struct PublicKey(u8, String);
impl PublicKey {
pub fn of(name: &str) -> PublicKey {
let sum = name.as_bytes().iter().fold(0u8, |a, i| a.wrapping_add(*i));
PublicKey(sum, name.to_owned())
}

Keybase proof

I hereby claim:

  • I am nic-hartley on github.
  • I am nichartley (https://keybase.io/nichartley) on keybase.
  • I have a public key whose fingerprint is 7A66 2C29 83BD 687C B737 4B50 5DB5 846B 8EDA 60D1

To claim this, I am signing this object:

asdf asdf fkjdkjf

General notes, first:

  • Each of these blocks runs repeatedly on its own thread.
    • There might be some delay (to let queues refill, or to keep from getting ratelimited by Reddit, or whatever) between each run; in theory, that shouldn't matter to the actual operation.
    • Some additional boilerplate is probably also required (checking if they're empty, etc.) but screw writing all that
  • Anything before .push or .pop is a queue
  • logging and metrics have been intentionally omitted; they can be added where necessary.
/*
This gist demonstrates an issue with Clang-Tidy, I think.
Basically, you shouldn't be required to initialize all members of a
union, for obvious reasons, but Clang-Tidy doesn't care that the
"missing" members are part of a union, and tries to get them to be
initialized anyway.
*/
struct Type {
@nic-hartley
nic-hartley / settings.json
Created May 10, 2017 06:06
My VS Code settings as they are now.
{
"diffEditor.ignoreTrimWhitespace": false,
"editor.acceptSuggestionOnCommitCharacter": false,
"editor.detectIndentation": false,
"editor.fontSize": 12,
"editor.fontFamily": "Source Code Pro, 'Courier New', monospace",
"editor.formatOnType": true,
"editor.insertSpaces": true,
"editor.minimap.enabled": true,
"editor.minimap.renderCharacters": false,
@nic-hartley
nic-hartley / clicommands.js
Created May 3, 2017 05:17
A NodeJS mini-module-thing that allows fairly simple handling of command-line commands for your server
((initialCommands, undefined) => {
const readline = require('readline');
let commands = typeof initialCommands !== 'object' ? {} : initialCommands;
function replaceCommand(name, func) {
commands[name] = [func];
}
function addCommand(name, func) {
@nic-hartley
nic-hartley / ColoredWalker.cs
Created March 30, 2017 07:47
A full program for a WinForms-based app that draws a few colorful Drunkards' Walks.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace ColorWalker
{
class Walker
{
private int _lastX = 0, _lastY = 0;