Skip to content

Instantly share code, notes, and snippets.

@Ravarcheon
Ravarcheon / spectralRotation.py
Created May 18, 2024 13:23
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 = np.real(ifft(x))
@efirdc
efirdc / pytorch_connected_components.py
Created June 8, 2020 01:37
Connected components in pytorch
# Demonstration: https://www.youtube.com/watch?v=5AvHrIK-Kjc&feature=youtu.be
# rand_cmap from https://stackoverflow.com/questions/14720331/how-to-generate-random-colors-in-matplotlib
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from visualizations import rand_cmap
W = H = 64
img = torch.randn(W, H).to(device)
@mjbalcueva
mjbalcueva / password-input.tsx
Last active May 18, 2024 20:08
shadcn ui custom password input
"use client"
import { forwardRef, useState } from "react"
import { EyeIcon, EyeOffIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Input, InputProps } from "@/components/ui/input"
import { cn } from "@/lib/utils"
const PasswordInput = forwardRef<HTMLInputElement, InputProps>(
({ className, ...props }, ref) => {
@loftywaif002
loftywaif002 / api_keys_android.md
Last active May 18, 2024 20:05
Hiding Api Keys in Anroid

Hiding API keys in local.properties

  1. Make sure your build directory is gitignored. It should be, by default, in a new Android Studio project -- you can double check by making sure that your .gitignore file contains the line:
/build
  1. In your project root directory, add the API key to local.properties file like this:
@cibyr
cibyr / uudecode.sh
Created April 10, 2013 05:12
uudecode in bash
if ! hash uudecode; then
uudecode() {
bs=0
while read -rs t ; do
if [ $bs -eq 1 ] ; then
if [ "a$t" = "aend" ] ; then
bs=2
else
x=1
i=($(printf "%d " "'${t:0:1}" "'${t:1:1}" "'${t:2:1}" "'${t:3:1}" "'${t:4:1}" "'${t:5:1}" "'${t:6:1}" "'${t:7:1}" "'${t:8:1}" "'${t:9:1}" "'${t:10:1}" "'${t:11:1}" "'${t:12:1}" "'${t:13:1}" "'${t:14:1}" "'${t:15:1}" "'${t:16:1}" "'${t:17:1}" "'${t:18:1}" "'${t:19:1}" "'${t:20:1}" "'${t:21:1}" "'${t:22:1}" "'${t:23:1}" "'${t:24:1}" "'${t:25:1}" "'${t:26:1}" "'${t:27:1}" "'${t:28:1}" "'${t:29:1}" "'${t:30:1}" "'${t:31:1}" "'${t:32:1}" "'${t:33:1}" "'${t:34:1}" "'${t:35:1}" "'${t:36:1}" "'${t:37:1}" "'${t:38:1}" "'${t:39:1}" "'${t:40:1}" "'${t:41:1}" "'${t:42:1}" "'${t:43:1}" "'${t:44:1}" "'${t:45:1}" "'${t:46:1}" "'${t:47:1}" "'${t:48:1}" "'${t:49:1}" "'${t:50:1}" "'${t:51:1}" "'${t:52:1}" "'${t:53:1}" "'${t:54:1}" "'${t:55:1}" "'${t:56:1}" "'${t:57:1}" "'${t:58:1}" "'${t:59:1}" "'${t:60:1}"))
@dhh
dhh / linux-setup.sh
Last active May 18, 2024 20:13
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl btop \
docker.io docker-buildx \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev mupdf mupdf-tools \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@MrKelpy
MrKelpy / OpenMAINT-2.3-U20.04-InstallationGuide.md
Last active May 18, 2024 20:00
Installation Guide for openMAINT 2.3 (CMDBuild 3.4.1) in Ubuntu 20.04 LTS

Introduction

OpenMAINT is notoriously hard to install and set up, so I've decided to go ahead and document the steps I took to install it, alongside every bit of information for others that might find it useful.

Important: Not only is openMAINT hard to install, it's also hard to understand. I've created a simple "All you need to know" guide to openMAINT that can be found here.


Acknowledgements, Necessities, etc

⠀⠀⠀⠀If you're reading this wondering why docker can't simply be used to make our life easier... go ahead and try it for yourself. If you're one of the lucky ones who got it working, then great! If not, accept it, relate to us and keep reading this guide. If you're still a bit skeptic about it, I have some notes about docker at the end of the guide, so go take a look.
⠀⠀⠀⠀Either way, we'r

@hjertnes
hjertnes / doom.txt
Created April 6, 2018 08:28
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch
@xeptore
xeptore / shadowsocks-ubuntu-20.04-installation.md
Last active May 18, 2024 19:52
Shadowsocks Ubuntu 20.04 Installation Guide
  1. Install

    sudo apt update
    sudo apt install shadowsocks-libev
  2. Configure

    sudo vim /etc/shadowsocks-libev/config.json
@IsaacXen
IsaacXen / README.md
Last active May 18, 2024 19:48
(Almost) Every WWDC videos download links for aria2c.