Skip to content

Instantly share code, notes, and snippets.

View ifd3f's full-sized avatar
🦀
🐍 λ

Astrid Yu ifd3f

🦀
🐍 λ
View GitHub Profile
@ifd3f
ifd3f / ansible-syntactic-macro.yml
Last active May 1, 2024 19:20
sorta-syntactic-macros in ansible
- name: ansible has syntactic macros ehe :3
hosts: ::1
connection: local
tasks:
- name: Run a shell command and register its output to foo_result
ansible.builtin.shell: echo myfoo first
register: foo_result
- name: Syntactically generate some tasks
copy:
#include <functional>
#include <iostream>
#include <memory>
#include <optional>
#include <sstream>
#include <string>
template <class A> class Maybe {
std::unique_ptr<A> contents;
Maybe(std::unique_ptr<A> contents) : contents(std::move(contents)) {}
@ifd3f
ifd3f / scribe-notes-2021-09-24.tex
Last active September 24, 2021 22:05
CSC 349 Scribe Notes
\title{CSC 349 - Recurrence Relations}
\author{Astrid Yu}
\date{September 24, 2021}
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{multicol}
\usepackage{hyperref}
\usepackage{amsthm}
@ifd3f
ifd3f / template_search_tree.cpp
Last active February 14, 2022 07:54
A compile-time binary search tree implementation using C++ templates.
#include <iostream>
template <bool condition, typename T, typename F>
struct Conditional {
typedef F result;
};
template <typename T, typename F>
struct Conditional<true, T, F> {
typedef T result;
--[[
The_Enderpenguin's Simple Big Reactors Script
Usage: > reactor <port id> [redstone, default top]
]]
REACTOR_ENERGY = 10000000
MAX_ENERGY = 9000000 -- The maximum amount of energy allowed
MIN_ENERGY = 1000000 -- The minimum amount of energy allowed
interface LoopBuffer {
int push(int insert);
}
class ArrayLoopBuffer implements LoopBuffer {
private int[] buf;
private int index = 0;
public ArrayLoopBuffer(int size) {
@ifd3f
ifd3f / plot_pid_csv.py
Created November 29, 2017 03:14
Plot CSV file(s) describing PID output.
import matplotlib.pyplot as plt
from matplotlib import gridspec
import sys
import pandas as pd
paths = sys.argv.copy()
del paths[0]
count = len(paths)
@ifd3f
ifd3f / snake.py
Created March 2, 2016 05:23
Simple snake game
import random
import sys
import time
import pygame
BACKGROUND_COLOR = (0, 0, 0)
SNAKE_COLOR = (0, 255, 0)
FOOD_COLOR = (255, 0, 0)
BORDER_COLOR = (0, 0, 255)