Skip to content

Instantly share code, notes, and snippets.

View cuibonobo's full-sized avatar

Jen Garcia cuibonobo

View GitHub Profile
@cuibonobo
cuibonobo / httrack_cleaner.py
Last active August 12, 2024 17:05
Clean an HTTrack archive so that it can be used as a static site. This particular script was used to convert a WordPress site into a static site. Note that this assumes that external sites are kept as absolute URLs. I've included some sample HTTrack options for example.com that work with this script.
import argparse
import distutils.dir_util
import glob
import os
import re
import shutil
import typing
import urllib.parse
import urllib.request
@cuibonobo
cuibonobo / stable-diffusion-optimized.md
Last active October 2, 2022 03:46
Instructions for installing an optimized version of Stable Diffusion. Use this guide if your GPU has less than the recommended 10GB of VRAM for the 'full' version.

stable-diffusion (optimized)

Instructions for installing an optimized version of Stable Diffusion. Use this guide if your GPU has less than the recommended 10GB of VRAM for the 'full' version.

The optimized version is from basujindal/stable-diffusion. See that repo for additional img2img and inpaint commands, plus an explanation of the arguments supplied to each command.

Pre-requisites

  • A graphics card that supports NVIDIA CUDA
  • The CUDA Toolkit has been installed
  • Miniconda has been installed for all users
  • The conda command is available on the command line. Usually this means that Miniconda's condabin directory is in your PATH system environment variable.
import ffmpeg
# Project settings
width = 1920
height = 1080
fps = 24
# Input movie settings
movie_path = "/tmp/zou/33d9712d-d093-478f-89e6-537bea667535.mp4.tmp"
w = 960
@cuibonobo
cuibonobo / booklet.js
Last active December 23, 2020 18:43
Change the order of the pages in a PDF to create a booklet using mutool.
/*
Usage:
mutool run booklet.js input.pdf output.pdf
*/
function copyPage(dstDoc, srcDoc, pageNumber, graftMap) {
var srcPage = srcDoc.findPage(pageNumber - 1);
var dstPage = dstDoc.newDictionary();
dstPage.Type = dstDoc.newName("Page");
@cuibonobo
cuibonobo / multiple_push_repos.bash
Last active December 18, 2020 22:29
Pushing to multiple repositories at the same time. (This will also work with HTTP URLs.)
git remote set-url --add --push origin [email protected]:org_1/the_repo.git
git remote set-url --add --push origin [email protected]:org_2/the_repo.git
# Note: Even if you cloned the repo directly from one of these addresses, you still
# need to set them again as a push URL!
@cuibonobo
cuibonobo / index.d.ts
Created April 18, 2020 16:17 — forked from eh-dub/index.d.ts
Sapper + Svelte + Typescript
// in $PROJECT_ROOT/typings/@sapper
declare module '@sapper/app' {
// from sapper/runtime/src/app/types.ts
// sapper doesn't export its types yet
interface Redirect {
statusCode: number
location: string
}
// end
@cuibonobo
cuibonobo / react-rollup-typescript.md
Created August 20, 2019 14:27 — forked from bcherny/react-rollup-typescript.md
react + rollup + typescript boilerplate

terminal:

npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx

Keybase proof

I hereby claim:

  • I am cuibonobo on github.
  • I am cuibonobo (https://keybase.io/cuibonobo) on keybase.
  • I have a public key ASDWjBYTPTz1K39DZrOxWOKxIQulD85v2QAx2wwOEW1p0Ao

To claim this, I am signing this object:

@cuibonobo
cuibonobo / CmdInit.cmd
Created June 13, 2018 18:54
Windows CMD.exe customization
@echo off
rem Place this file wherever you want, then create a new `AutoRun` string in
rem `Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor` that points to its location
rem This will print the username in magenta
set userprompt=$E[35m%username%$E[0m
rem This will print the current directory in green
set pathprompt=$E[32m$p$E[0m
@cuibonobo
cuibonobo / react-native-typescript.md
Last active May 29, 2018 16:59
How to create a TypeScript-enabled React Native starter app without relying on cloning boilerplates or example projects.

React Native Typescript App

Make sure you have some global CLI tools installed:

npm install -g typescript create-react-native-app

You may also want to update npm to the latest version: