Skip to content

Instantly share code, notes, and snippets.

@evpo
evpo / bash.log
Created February 10, 2018 13:01
GnuPG: Sample commands to store master key offline and use subkeys
##############################
# In your underground bunker:
##############################
ubuntu@sign-key-owner:~$ gpg2 --list-secret-keys
/home/ubuntu/.gnupg/pubring.gpg
-------------------------------
sec rsa2048/26AD9CA6 2018-02-10 [SC] [expires: 2018-02-20]
uid [ultimate] Shelling Point <nowhere@north.pole>
ssb rsa2048/4CC51AF4 2018-02-10 [E] [expires: 2018-02-20]

why doesn't radfft support AVX on PC?

So there's two separate issues here: using instructions added in AVX and using 256-bit wide vectors. The former turns out to be much easier than the latter for our use case.

Problem number 1 was that you positively need to put AVX code in a separate file with different compiler settings (/arch:AVX for VC++, -mavx for GCC/Clang) that make all SSE code emitted also use VEX encoding, and at the time radfft was written there was no way in CDep to set compiler flags for just one file, just for the overall build.

[There's the GCC "target" annotations on individual funcs, which in principle fix this, but I ran into nasty problems with this for several compiler versions, and VC++ has no equivalent, so we're not currently using that and just sticking with different compilation units.]

The other issue is to do with CPU power management.

@dhermes
dhermes / .gitignore
Last active December 12, 2022 06:38
Remez Algorithm for log(x)
*.pyc
*.aux
*.log
*.out
// Commented version of https://twitter.com/zozuar/status/1441384708441456651
// Google-translated (with some editing) from @gam0022's version
float i, // Ray marching loop counter
e, // Volume density (the smaller the value, the higher the density)
s, // FBM scale (and loop counter)
g, // Ray's distance (also used for tunnel twirl and camera prespective)
k = .01; // Handy constant
// Ray marching loop
@bjodah
bjodah / gist:bf554c4eb6d75837c00b4ec01991da05
Last active April 11, 2022 11:48
Using emacs under windows
1. Install msys2 from msys2.org
2. run msys2.exe: pacman -Syu, restart, pacman -Su
3. run mingw64.exe: pamcan -S mingw-w64-x86_64-emacs
4. create C:\msys2_64\runemacs_patched_path.bat:
cmd /C "set PATH=C:\msys2_64\mingw64\bin;C:\msys2_64\usr\bin;%PATH% && C:\msys2_64\mingw64\bin\runemacs.exe --daemon"
5. Super-R shell:startup [RET]
6. Create shortcut to runemacs_patched_path.bat, call it e.g. "emacs-daemon"
7. Create a short-cut in Start menu:
C:\msys2_64\mingw64\bin\emacsclientw.exe -c -n -a "C:\msys2_64\mingw64\bin\runemacs.exe"
@karlrohe
karlrohe / PCA_on_handwritten_2s.R
Created January 7, 2022 22:48
PCA on mnist handwritten 2's
# PCA on n=6990 images of handwritten 2's, each with d = 784 pixels.
# install.packages("remotes")
# remotes::install_github("jlmelville/snedata")
# thank you jlmelville for making this data so easy to access!
library(snedata)
library(magrittr)
library(Matrix)
library(rARPACK)
@piyushrpt
piyushrpt / customfeedstock.md
Last active October 21, 2021 20:17
Setting up custom conda feedstock
@twlz0ne
twlz0ne / test-lsp-jdtls-installation.el
Created May 11, 2020 03:55
Test jdtls installation #Emacs #LSP
;;; test-lsp-jdtls-installation.el --- Test lsp jdtls installation -*- lexical-binding: t; -*-
;;; Date: 2020-05-11_09.12.50
;;; Usage:
;; ┌────
;; │ $ emacs -nw -Q -l \
;; │ --eval '(setq with-proxy-http-server "127.0.0.1:XXXX")' \
;; │ /path/to/test-lsp-jdtls-installation.el
;; └────
(toggle-debug-on-error)
(setq user-emacs-directory (format "~/.emacs.d/%s/%s/" (file-name-base load-file-name) emacs-version))
@jalavik
jalavik / unicode_to_latex.py
Created May 17, 2011 11:04 — forked from beniwohli/unicode_to_latex.py
Map to convert unicode characters to their respective LaTeX representation
# original XML at http://www.w3.org/Math/characters/unicode.xml
# XSL for conversion: https://gist.github.com/798546
unicode_to_latex = {
u"\u0020": "\\space ",
u"\u0023": "\\#",
u"\u0024": "\\textdollar ",
u"\u0025": "\\%",
u"\u0026": "\\&amp;",
@bjodah
bjodah / .gitignore
Last active August 4, 2020 20:04
Script to compile symengine with memory sanitizer enabled.
mount_*/
environment_*/
output.log