Skip to content

Instantly share code, notes, and snippets.

@thomwolf
thomwolf / fast_speech_text_speech.py
Last active May 9, 2024 11:05
speech to text to speech
""" To use: install LLM studio (or Ollama), clone OpenVoice, run this script in the OpenVoice directory
git clone https://github.com/myshell-ai/OpenVoice
cd OpenVoice
git clone https://huggingface.co/myshell-ai/OpenVoice
cp -r OpenVoice/* .
pip install whisper pynput pyaudio
"""
from openai import OpenAI
import time
@SkaveRat
SkaveRat / gist:9fce0c63458c369a9095
Created July 11, 2015 17:51
Generating matrix.org synapse self signed certificate
# Set your domain here
MXDOMAIN=m.example.com
# This script will ask you for a password. This is for your CA key and you need it in the next step, when signing your application certificate with your CA key. You can remove the "-aes256" flag in the first line to create a passwordless key, but it is not advised in production.
# Let this script run, and move the generated *.tls.* files into your synapse home directory and restart synapse.
# For android to recognize this, you need to copy the "ca.crt.pem" file to your phone and go to: "Settings->Security->import from SD card" and select the pem-file.
# This certificate has a "CA-Flag" set to true, otherwise android would not import this file correctly.
openssl genrsa -aes256 -out ca.key.pem 4096
@kamui545
kamui545 / dock.sh
Created October 24, 2019 03:37
Customize macOS dock via command line
#!/usr/bin/env bash
source "./dock_functions.sh"
declare -a apps=(
'/System/Applications/Utilities/Terminal.app'
'/System/Applications/Music.app'
'/Applications/Google Chrome.app'
'/Applications/PhpStorm.app'
'/Applications/Visual Studio Code.app'
def strict : Bool -> Type
| true => Unit
| false => Empty
def f : (n:Nat) -> strict (n > 0) -> Nat := by
intros n
match n with
| .zero => simp; exact fun i => by nomatch i
| n@(.succ _) => simp; exact fun () => n

How to add an image to a gist

  1. Create a gist if you haven't already.
  2. Clone your gist:
    # make sure to replace `<hash>` with your gist's hash
    git clone https://gist.github.com/<hash>.git # with https
    git clone git@gist.github.com:<hash>.git     # or with ssh

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Create Free AWS Account

Create free AWS Account at https://aws.amazon.com/

2. Create and Lauch an EC2 instance and SSH into machine

I would be creating a t2.medium ubuntu machine for this demo.

@Xswexx
Xswexx / index.html
Last active May 9, 2024 10:58
On-Scroll Fire Transition (WebGL + GSAP ScrollTrigger)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>موقعي الشخصي</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
@skurfuerst
skurfuerst / gen-types.mjs
Created January 16, 2021 21:10
Generate runtypes from TypeScript definitions using ts-morph
// RUN with a recent node.js version, using "node gen-types.mjs"
// DEPENDS on typescript and ts-morph
import { Project } from "ts-morph";
import { writeFileSync } from "fs";
const project = new Project({
tsConfigFilePath: "tsconfig.json",
});
@artemonsh
artemonsh / tokens.md
Created April 6, 2023 18:10 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active May 9, 2024 10:55
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',