Skip to content

Instantly share code, notes, and snippets.

@krolow
krolow / gist:4529579ea0697a7e003bbe21a76ba8eb
Created May 5, 2024 15:35
Expo running on android emulator crashing when chrome was opening, the emulator was closing
Ubuntu 22.04.3
Expo running on android emulator crashing when chrome was opening, the emulator was closing
To solve added a file in ~/.android/advancedFeatures.ini
Vulkan = off
GLDirectMem = on
@SChinchi
SChinchi / RoR2AssetDump.cs
Last active May 19, 2024 20:51 — forked from yekoc/RoR2AssetDump.cs
Label game object children as `currentIndex / total`
Awake of your mod
RoR2Application.onLoad += Thing;
private static bool IsNetworkBaseType(Type type)
{
return type.BaseType != null && type.BaseType == typeof(UnityEngine.Networking.NetworkBehaviour);
}
private static bool HasValidBaseType(Type type)
@miodeqqq
miodeqqq / recaptcha_im_not_robot.py
Created December 8, 2017 18:36
Clicks "I'm not robot" when captcha occurs.
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.ui import WebDriverWait
driver = webdriver.Chrome()
@patmigliaccio
patmigliaccio / install-cf-gae-ssl.md
Last active May 19, 2024 20:50
Configuring Cloudflare SSL/TLS certificates on Google App Engine

Configuring Cloudflare SSL/TLS on Google App Engine

Implementing end-to-end HTTPS encryption with CloudFlare for Google App Engine applications.

Google App Engine - Custom Domains

Add Domains

Register the root domain with Google Cloud Platform at the following:

@codeinthehole
codeinthehole / osx_bootstrap.sh
Last active May 19, 2024 20:47
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@Ravarcheon
Ravarcheon / spectralRotation.py
Last active May 19, 2024 20:40
rotates an audio file by 90 degrees in the spectrum while being a reversible process with minimal loss (only floating point errors which are like -150 dB but thats literally silence ahaha~)
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)

Scaling your API with rate limiters

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.

Request rate limiter

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.

@valldrac
valldrac / true-black-theme.patch
Last active May 19, 2024 20:37
wip/true-black-theme
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
@lucasferreira
lucasferreira / git.md
Created August 10, 2021 14:26 — forked from leocomelli/git.md
Lista de comandos úteis do GIT

GIT

Estados

  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);

Ajuda