Skip to content

Instantly share code, notes, and snippets.

View cfr's full-sized avatar
💭
👾

Stan Serebryakov cfr

💭
👾
View GitHub Profile
@VictorTaelin
VictorTaelin / implementing_fft.md
Last active November 12, 2024 09:06
Implementing complex numbers and FFT with just datatypes (no floats)

Implementing complex numbers and FFT with just datatypes (no floats)

In this article, I'll explain why implementing numbers with just algebraic datatypes is desirable. I'll then talk about common implementations of FFT (Fast Fourier Transform) and why they hide inherent inefficiencies. I'll then show how to implement integers and complex numbers with just algebraic datatypes, in a way that is extremely simple and elegant. I'll conclude by deriving a pure functional implementation of complex FFT with just datatypes, no floats.

////===--- EitherSequence.swift - A sequence type-erasing two sequences -----===//
////
//// This source file is part of the Swift.org open source project
////
//// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
//// Licensed under Apache License v2.0 with Runtime Library Exception
////
//// See https://swift.org/LICENSE.txt for license information
//// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
////
@wilvk
wilvk / kill_open_files.sh
Created August 16, 2017 06:50
Linux - Kill all processes of deleted files that are still open
#!/bin/bash
lsof|grep deleted|awk '{print $2}'|xargs kill -9
@floooh
floooh / NetClient.cc
Created January 18, 2017 16:07
NetClient.h (emscripten/osx/win)
//------------------------------------------------------------------------------
// NetClient.cc
//------------------------------------------------------------------------------
#if ORYOL_WINDOWS
#define _WINSOCK_DEPRECATED_NO_WARNINGS (1)
#include <WinSock2.h>
typedef int ssize_t;
#endif
#if ORYOL_POSIX
@codelahoma
codelahoma / xcode-todo-fixme-as-warning.sh
Created October 15, 2016 19:11
Highlight TODO and FIXME as warnings in Xcode 8 (add as script build phase)
TAGS="TODO:|FIXME:"
SKIPDIRS="/Carthage"
find "${SRCROOT}/" -type f \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 \
| xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" \
| grep -v "$SKIPDIRS" \
| perl -p -e "s/($TAGS)/ warning: \$1/"

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

#!/usr/bin/env python3
# licence: ¯\_(ツ)_/¯
import requests
s = requests.Session()
d = {
'client_id': 'client_id',
'client_secret': 'client_secret',
@alejandro-isaza
alejandro-isaza / PrintToFile.py
Created July 10, 2015 18:33
lldb command to print an array to a file in disk
#!/usr/bin/python
import lldb
import os
import re
import subprocess
import fblldbbase as fb
def lldbcommands():
return [ PrintToFile() ]
@siers
siers / demo
Created June 28, 2015 22:36
Extracts paragraphs to lines in files to allow generic operations be used
demo % cat file
1. Chox4ez9
Oov5iedeiF
ea7eapheeR
2. tu0ahTho
sheit5Kash
aiHiewae1i
3. Gau2Jesu
@paulirish
paulirish / bling.js
Last active November 4, 2024 17:48
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype;