Discover gists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import soundfile as sf | |
from scipy.fftpack import fft, ifft | |
def rotateSignal(signal,flip): | |
if flip: | |
signal = signal[::-1] | |
x = np.concatenate((signal, signal[1:][::-1])) # concatenating the array with a reverse of itself makes it such that the fourier transform doesn't layer over a reversed version of itself in the inverse fft | |
rotSig = ifft(x) |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 154c5879d48d0165b6bf3a37047dc38ee579b0f9 (HEAD -> wip/true-black-theme) | |
Author: Oscar Mira <valldrac@molly.im> | |
Commit: Oscar Mira <valldrac@molly.im> | |
Add dark theme with true black background color | |
diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationFragment.kt | |
index 0cdf7dcf91..6ac4eef67f 100644 | |
--- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationFragment.kt | |
+++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationFragment.kt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export LC_ALL=C | |
set -eu | |
if test "$(id -u)" -ne 0; then | |
echo "install: must be root" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Unlit/PolyRhythmVisualizer" { | |
Properties { | |
_TimeCode ("Input Time", Float) = 0 | |
_OuterRingFreq ("Outer Ring Frequency", Float) = 1 | |
_InnerRingFreq ("Inner Ring Frequency", Float) = 0.922 | |
_RingCount ("Ring Count", Int) = 35 | |
_VibrantFreq ("Vibrant Frequency", Float) = 2 | |
_Vibrant ("Vibrant", Range(0, 1)) = 0.5 | |
_Decay ("Decay", Range(0, 10)) = 2 | |
[Header(Cosine Gradiant)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import os | |
import random | |
from collections import deque | |
import ssl | |
from urllib.parse import urlparse | |
import aiohttp | |
import polars as pl | |
import aiofiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* servo motor control example | |
This example code is in the Public Domain (or CC0 licensed, at your option.) | |
Unless required by applicable law or agreed to in writing, this | |
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR | |
CONDITIONS OF ANY KIND, either express or implied. | |
*/ | |
#include <stdio.h> | |
#include "freertos/FreeRTOS.h" | |
#include "freertos/task.h" |
NewerOlder