Skip to content

Instantly share code, notes, and snippets.

View Tritlo's full-sized avatar

Matthías Páll Gissurarson Tritlo

View GitHub Profile
@rsvp
rsvp / noise.sh
Last active April 18, 2024 14:18
noise : relaxing ambient Brown noise generator (cf. white noise) | Linux bash script using sox | CogSci notes
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2019-01-02
#
# _______________| noise : ambient Brown noise generator (cf. white noise).
#
# Usage: noise [minutes=59] [band-pass freq center=1786] [wave]
# ^minutes can be any positive integer.
# Command "noise 1" will display peak-level meter.
#
# Dependencies: play (from sox package)
@TerrorBite
TerrorBite / DCPU.cpp
Created April 23, 2012 05:30
DCPU-16 emulator written in C++
#include "DCPU.h"
using namespace std;
DCPU::DCPU(void) {
// Allocate memory space
mem = new uint16_t[0x10000];
cout << "Allocated 128k memory" << endl;
}
@Tritlo
Tritlo / PrufuGen.java
Last active December 14, 2015 01:09
A small program that generates variables for Xilinx testbenches, written when I was in digital design.
#Copyright (C) 2012 Matthías Páll Gissurarson
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWA
@Tritlo
Tritlo / McCabeCounter.py
Last active December 14, 2015 15:28
A program that calculates the (McCabe complexity)[https://en.wikipedia.org/wiki/McCabe_complexity] of python programs in a directory and subdirectories. Usage: python McCabeCounter.py directory
#!/usr/bin/python
#encoding utf-8
import sys, os
from itertools import takewhile
def getFuncs(filename, funcDef = "def "):
lines = open(filename,'r').readlines()
funcDefIn = lambda line: True if line.strip().startswith(funcDef) else False
funcs = map(lambda i: [lines[i]] + list(takewhile(lambda x: not funcDefIn(x),lines[i+1:])),filter(lambda i: funcDefIn(lines[i]),range(len(lines))))
# grabs lines until start of next func/end of file lines where functions start
@Tritlo
Tritlo / PlyReader.js
Last active October 27, 2022 07:40
A reader for PLY files for WebGL. Only reads points and normals, currently.
//PlyReader.js (C) 2014 Matthias Pall Gissurarson.
//Partially based on https://github.com/gnomeby/canvas3D, which has no License.
/*
The MIT License (MIT)
Copyright (c) 2014 Matthias Pall Gissurarson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@goldfirere
goldfirere / Vec.hs
Last active December 5, 2016 13:50
{-# LANGUAGE TemplateHaskell, ScopedTypeVariables, TypeInType, TypeOperators,
TypeFamilies, GADTs, UndecidableInstances, InstanceSigs #-}
{-# OPTIONS_GHC -Wincomplete-patterns #-}
import Data.Kind
import Data.Singletons.TH
import Data.Singletons.Prelude
import Prelude hiding ( take )
$(singletons [d|
@plexsoup
plexsoup / LightCrumb.js
Last active February 7, 2017 12:15
LightCrumb - based on "Mark" by the Aaron. For lighting your trail on maps with dynamic lighting.
// Gist: https://gist.github.com/plexsoup/64852540504101b520b25f7c3fa84e5f
// By: Plexsoup - copied from Mark by The Aaron. With help from Scott C, Stephen L and Tritlo
// Thanks: Testers and Feedback: al e., DM Robzer, Vince, Pat S, Gold, Anthony, Kryx, Sudain
// Contact: https://app.roll20.net/users/258125/plexsoup
// Roll20 API Script to leave a breadcrumb trail of torches. Based on "Mark" from The Aaron //
/*