Skip to content

Instantly share code, notes, and snippets.

View pce's full-sized avatar

Patrick C. Engel pce

  • UTC+1
View GitHub Profile
@pce
pce / calculator.cpp2
Created January 5, 2023 11:48
playing with cppfront
struct Token {
enum Type { integer, plus, minus, mul, div, lparen, rparen } type;
std::string text;
Token(Type type, const std::string& text) : type(type), text(text) {}
friend std::ostream& operator<<(std::ostream& os, const Token& token) {
os << " " << token.text << " ";
return os;
#include <assert.h>
template<typename T>
T Min(T a, T b)
{
return (a < b) ? a : b;
}
// Test
#include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
using std::vector;
using std::cout;
using std::unordered_map;
using std::string;
@pce
pce / fibo.cpp
Last active August 8, 2020 23:46
// g++ -std=c++11 fibo.cpp && ./a.out
#include <iostream>
#include <vector>
std::vector<int> f(std::vector<int> &v, int i, int n)
{
int j = 1;
if (i <= n) {
j = v.back();
v.push_back(i);
@pce
pce / aoc_01-sumofofodd.cpp
Last active August 8, 2020 10:18
To compile and play with the sum of odds in C++: `g++ aoc_01-sumofofodd.cpp && ./a.out` or `clang++ -std=c++11 -stdlib=libc++ -g aoc_01-sumofofodd.cpp && ./a.out`
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
using std::cout;
using std::string;
using std::vector;
@pce
pce / arpeggio.orc
Last active March 3, 2020 23:11
Csound Practice
;; Select this code and press ctrl-e to evaluate
;; reset_clock()
set_tempo(120)
set_scale("min")
; start("ReverbMixer")
start("FBReverbMixer")
instr Add
#/bin/bash
cd ~/Music
# youtube-dl -f bestaudio --extract-audio --embed-thumbnail --add-metadata $1 || youtube-dl -f bestaudio --extract-audio --add-metadata $1
youtube-dl -f bestaudio --extract-audio --embed-thumbnail --audio-format mp3 --audio-quality 0 $1
@pce
pce / ml.md
Last active September 4, 2019 12:16

Garbage

"Unlogische" Zusammenhänge die "nur" für die Maschine erkennbar sind.

Videos

@pce
pce / shell-tools.md
Last active August 7, 2019 18:09
shell-tools