Skip to content

Instantly share code, notes, and snippets.

@hemmer
hemmer / Makefile
Last active January 31, 2020 18:24
Example of FFTW transforms with various indexing methods. See printDataFourier for examples.
program_NAME := fourier
CC = cc
program_C_SRCS := $(wildcard *.c) $(wildcard */*.c)
program_C_OBJS := ${program_C_SRCS:.c=.o}
program_OBJS := $(program_C_OBJS) $(program_CXX_OBJS)
program_INCLUDE_DIRS :=
program_LIBRARY_DIRS :=
program_LIBRARIES := pthread fftw3 m gsl gslcblas
program_FLAGS := -Wall -Wextra -g -std=c99 -Wshadow
#program_FLAGS := -Wall -Wextra -O3 -std=c99 -Wshadow
@hemmer
hemmer / gist:6864729
Last active December 24, 2015 21:19
Mathematica factoring
Here is an example input:
In[89]:= AA = 1/(24 \[Eta] \[Tau]C \[Tau]Q) (-12 \[Eta] \[Tau]Q - 12 a^2 GC \[Tau]C \[Tau]Q - 3 \[Zeta] \[Tau]C \[Tau]Q + 5 \[Zeta] \[Xi] \[Tau]C \[Tau]Q + Sqrt[(48 \[Zeta] \[Eta] (-3 + 5 \[Xi]) \[Tau]C + (12 \[Eta] + (12 a^2 GC + \[Zeta] (3 - 5 \[Xi])) \[Tau]C)^2) \[Tau]Q^2])
This method doesn't work:
In[90]:= Solve[AA == 0, \[Zeta]]
During evaluation of In[90]:= $RecursionLimit::reclim: Recursion depth of 20 exceeded. >>
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\monokai]
"Colour21"="255,255,255"
"Colour20"="245,222,179"
"Colour19"="200,240,240"
"Colour18"="0,217,217"
"Colour17"="179,146,239"
"Colour16"="174,129,255"
"Colour15"="122,204,218"
@hemmer
hemmer / mesh.py
Created January 18, 2016 14:00
generating a nonuniform mesh
#!/usr/bin/env python
from scipy import optimize
from scipy import integrate
import numpy as np
import sys
l, L = 0.02, 1
N = 128
import time
import os
import numpy as np
from pathlib import Path
import tensorflow as tf
print("tensorflow version: ", tf.__version__)
@hemmer
hemmer / front-template
Created June 2, 2020 07:05
automatic kana
<div id="card-front">
<div id="quest">
<div id="quest-display">
{{Characters}}
</div>
<div id="quest-name"></div>
<div class="input">
{{type:Do_Not_Modify}}
</div>
</div>
@hemmer
hemmer / jisho_2_wanikani.js
Created September 27, 2020 16:53
Adds links to wanikani vocab pages from the button on jisho
// ==UserScript==
// @name Add proper Wanikani links to Jisho
// @version 1
// @grant none
// @include https://jisho.org*
// ==/UserScript==
var aTags = document.getElementsByTagName("a");
var searchText = "wanikani";
const int numLEDS = 4;
const int LEDs[numLEDS] = {5, 6, 3, 9};
int binaryVariable = 0;
void setup() {
// put your setup code here, to run once:
for (int k = 0; k < numLEDS; k++) {
pinMode(LEDs[k], OUTPUT);
analogWrite(LEDs[k], 0);
diff --git a/Makefile b/Makefile
index 74044665..9f048f58 100644
--- a/Makefile
+++ b/Makefile
@@ -106,7 +106,7 @@ cleandep:
$(MAKE) -C dep clean
run: $(STANDALONE_TARGET)
- ./$< -d
+ valgrind --track-origins=yes ./$< -d
@hemmer
hemmer / Makefile
Created October 28, 2022 07:39 — forked from Simon-L/Makefile
# Untar this in current dir
# https://github.com/alandefreitas/matplotplusplus/releases/download/v1.1.0/matplotplusplus-1.1.0-Linux.tar.gz
LDFLAGS = lib/libmatplot.a lib/Matplot++/libnodesoup.a -lpng -lz -ltiff -ljpeg
CXXFLAGS = -std=c++17 -I../chowdsp_wdf/include -Iinclude
SRC = main.cpp
OUT = main
$(OUT): $(SRC)