Skip to content

Instantly share code, notes, and snippets.

View kidGodzilla's full-sized avatar
👋
Working from home forever

James Futhey kidGodzilla

👋
Working from home forever
View GitHub Profile
#!/bin/bash
set -e
######################################################################
# This Bootstrap Script installs Dokku latest on Ubuntu (use LTS or latest)
#
# This script also installs UFW (firewall), some basic Dokku plugins, and
# raises ulimits. Comment out any step you wish to skip.
#
# IMPORTANT: This script also disables password authentication via SSH for
@dangovorenefekt
dangovorenefekt / blockmetatwitter.md
Last active July 5, 2024 08:04
Block Meta and Twitter (nginx)
@linuxandchill
linuxandchill / retrievalQA.js
Last active June 10, 2024 16:04
Create and retrieve embeddings using Langchain and Supabase
////////////////////////////////////
/* "dependencies": {
"@supabase/supabase-js": "^2.13.1",
"langchain": "^0.0.44"
} */
////////////////////////////////////
import { OpenAI } from "langchain/llms";
import {
@kidGodzilla
kidGodzilla / openai-chat-completion.js
Last active April 5, 2024 21:15
OpenAI Chat Completion Example
const { Configuration, OpenAIApi } = require('openai');
let openai;
const instructions = ``;
if (process.env.OPEN_AI_API_KEY) {
const configuration = new Configuration({ apiKey: process.env.OPEN_AI_API_KEY });
openai = new OpenAIApi(configuration);
}
@overflowy
overflowy / favicons-hn.user.js
Last active July 12, 2023 13:12
Favicons for HN
// ==UserScript==
// @name Favicons for HN
// @namespace Violentmonkey Scripts
// @match https://*.ycombinator.com/*
// @grant none
// @version 1.0
// @author overflowy@riseup.net
// @description 12/19/2022, 9:34:53 AM
// @inject-into content
// ==/UserScript==
class LineChart {
// LineChart by https://kevinkub.de/
constructor(width, height, values) {
this.ctx = new DrawContext();
this.ctx.size = new Size(width, height);
this.values = values;
}
_calculatePath() {
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@kahole
kahole / index.html
Last active April 26, 2024 06:04
*scratch*.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>*scratch*</title>
<style>
body {
font-family: Hack, Menlo, Monaco, 'Droid Sans Mono', 'Courier New', monospace;
white-space: pre;
@bfgits
bfgits / set ulimit
Created April 16, 2020 09:00
Set Permanently ulimit -n / open files in ubuntu
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 65535
user@ubuntu:~$ sudo vim /etc/sysctl.conf
# add the following line to it
fs.file-max = 65535

How to setup a practically free CDN using Backblaze B2 and Cloudflare

⚠️ Note 2023-01-21
Some things have changed since I originally wrote this in 2016. I have updated a few minor details, and the advice is still broadly the same, but there are some new Cloudflare features you can (and should) take advantage of. In particular, pay attention to Trevor Stevens' comment here from 22 January 2022, and Matt Stenson's useful caching advice. In addition, Backblaze, with whom Cloudflare are a Bandwidth Alliance partner, have published their own guide detailing how to use Cloudflare's Web Workers to cache content from B2 private buckets. That is worth reading,