Skip to content

Instantly share code, notes, and snippets.

View barnden's full-sized avatar

Brandon G. Nguyen barnden

View GitHub Profile
#include <iostream>
#include <limits>
#include <memory>
#include <queue>
#include <vector>
using Pair = std::pair<int, int>;
struct Edge {
int first;
@barnden
barnden / generic_bot.py
Created August 8, 2020 20:38
A Discord bot that archives pinned messages in a text channel named "pinned-messages".
import discord
class GenericClient(discord.Client):
async def on_ready(self):
print('Logged on as ', self.user)
guild = self.get_guild(GUILD_ID)
if (guild == None):
return
@barnden
barnden / functions.cpp
Created July 2, 2020 22:12
Mountain Paths HW using C++2a features
#include "functions.h"
const int32_t MAX = static_cast<int>(~uint32_t{} >> 1);
int colorPath(const std::vector<std::vector<int32_t>> &elevations,
std::vector<std::vector<int32_t>> &rgb,
int32_t color, const int32_t start) {
int32_t dist = 0, i = start;
auto get = [&](auto i, auto j, auto cur) -> int32_t {
@barnden
barnden / bulls-cows.cpp
Created July 1, 2020 15:27
Obfuscated Bulls and Cows HW (CSCE121)
#include <iostream>
#include <vector>
#include <cstdlib>
#include <chrono>
using namespace std;
typedef vector<int> V;
typedef string M;
typedef int L;
import numpy as np
from numba import jit
from matplotlib import pyplot as plt, colors
from multiprocessing import Pool, freeze_support
WIDTH = 5000
HEIGHT = 3000
PROCESSES = 8
x_div = WIDTH // 2
y_div = HEIGHT // 16
@barnden
barnden / clock.h
Last active June 17, 2019 23:43
Dynamically generate expressions that evaluate to a desired result.
#define ADD '+'
#define SUB '-'
#define MUL '*'
#define DIV '/'
#define MAX_FACTORS 5
#define MAX_OP_DOUBLE 2
#define DEBUG true
#ifdef NULL
#undef NULL
@barnden
barnden / pi.coffee
Last active June 18, 2017 14:53
Demonstrating convergent sums by calculating Pi
l = 750000000
pi = 3.14159265358979
f_1 = () ->
t = 0
c = 0
for x in [1...l] by 2
if c % 2 == 0
t += 1 / x
else
@barnden
barnden / Coffee.theme.css
Last active October 18, 2016 01:02
A theme for BetterDiscord
//META{"name":"Coffee","description":"I just want some coffee.","author":"Brandon_Nguyen","version":"1.17"}*//
.guilds-wrapper .guilds .guild.selected:before,
.badge {
background-color: #EB5937;
}
.footer .label {
color: #EB5937 !important;
}
.edit-container-inner .channel-textarea .channel-textarea-inner {
border-color: #EB5937 !important;
// Networking
rate "786432"
cl_cmdrate "128"
cl_updaterate "128"
cl_interp_ratio "1"
cl_lagcompensation "1"
sensitivity "0.3375" // 540 EDPI => 1.35 @ 400 DPI; 0.3375 @ 1600 DPI
zoom_sensitivity_ratio_mouse "1.0"
m_rawinput "1"
@barnden
barnden / discord_bot.js
Last active June 7, 2017 21:24
.abot 1.0
var Discord = require('discord.js');
var Winston = require('winston');
var fs = require('fs');
var request = require('request');
var defaultDir = "C:\\Users\\Brandon\\Desktop\\DiscordJSBot\\";
var bot = new Discord.Client();
var logger = new (Winston.Logger)({
transports: [
new (Winston.transports.Console)({}),