Skip to content

Instantly share code, notes, and snippets.

View BraedonWooding's full-sized avatar
🦝

Braedon BraedonWooding

🦝
  • Resonate Solutions
  • 19:43 (UTC +10:00)
View GitHub Profile
@BraedonWooding
BraedonWooding / FindUniqueWords.cpp
Last active August 17, 2022 10:44
Finds 5 unique words that have unique letters
/*
Can you find: five five-letter words with twenty-five unique letters?
FJORD
GUCKS
NYMPH
VIBEX
WALTZ
Q
Similar solution to https://gist.github.com/fredoverflow/a7c9f230d86787ed6164ef652f675d8d
// Type your code here, or load an example.
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#define _CONCAT(t1, t2) t1 ## t2
#define CONCAT(t1, t2) _CONCAT(t1, t2)
#define CLEANUP_ATTR(fn) __attribute__((cleanup(fn)))
typedef void (*cleanup_handle_fn)(void *arg);
@BraedonWooding
BraedonWooding / FileWatcher.py
Last active March 19, 2020 13:09
A directory watcher in python that is single module and python2 (just so anyone can use it regardless of what system)
#!/bin/python
# Fill these in
CONNECTION_STRING = ""
CONTAINER_NAME = ""
# Install required modules
# yah this is super ugly but I don't want people to have to run multiple steps
import subprocess;
using System;
using System.Collections.Generic;
using System.Linq;
public class Results
{
public double sum;
public double avg;
public double unique;
}
# Python program to get a set of
# places according to your search
# query using Google Places API
# importing required modules
import requests, json
template<typename Fn, typename ForEach>
std::optional<ParseError> ParseListConjugate(Fn fn, ForEach for_each,
Token pair_sep = Token::Colon,
Token next_pair = Token::Comma) {
int index = 0;
while (true) {
auto first = (this->*fn)();
if (!first) return first.error();
if (!ConsumeToken(pair_sep.type))
return ParseError(ParseError::Kind::MissingToken, "Requiring separator",
#!/usr/local/bin/bash
# For when you need to count lines based on file extensions so you can accurately see the difference
# You must be on a current branch before executing this
# Pass your author name as the input i.e. `./GitLineCounter.sh MyName`
git log --numstat --oneline --author="$1" --format= > file
declare -A addedLines=()
declare -A removedLines=()
while read line; do
#!/bin/sh
# Just a small bash script to run for all files under tests that end in .test
# To add execute permissions make sure you call `chmod +rwx test.sh`
if [ ! -d "tests/bin" ]; then
echo "Creating bin folder under tests/bin"
cd tests && mkdir bin
fi
#ifndef AST_H
#define AST_H
#include <experimental/optional>
#include "../../Utils/utils.h"
#include <utility>
#include <vector>
#include <string>
#include "../../Utils/variant.h"
seq 60 | sed 's/^/5^/' | bc | awk 'BEGIN{ print "\t\t{ .digits = 0, .cutoff = \"\" }," }
{
log2 = log(2)/log(10)
printf("\t\tLeftFast { .digits = %d, .cutoff = \"%s\" },\n", int(log2*NR + 1), $0)
}'