Skip to content

Instantly share code, notes, and snippets.

View definiteIymaybe's full-sized avatar

dfntlmb definiteIymaybe

View GitHub Profile
addEventListener('scheduled', event => {
event.waitUntil(handleSchedule(event.scheduledTime))
})
async function handleSchedule(scheduledDate) {
const url = `https://api.github.com/repos/${OWNER}/${REPO}/actions/workflows/${WORKFLOW_ID}/dispatches`
await fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/vnd.github+json',
@definiteIymaybe
definiteIymaybe / ChatGPT-translation.py
Created January 25, 2024 23:26 — forked from ymoslem/ChatGPT-translation.py
Minimal working code for translation with GPT-4, "gpt-3.5-turbo" (a.k.a. ChatGPT) and "text-davinci-003"
# pip3 install openai
import openai
import time
OPENAI_API_KEY = "your_api_key_here"
openai.api_key = OPENAI_API_KEY
prompt = """French: La semaine dernière, quelquun ma fait part de sa gratitude envers notre travail.
@definiteIymaybe
definiteIymaybe / termiWidget.js
Created January 7, 2024 00:29 — forked from spencerwooo/termiWidget.js
🍋 TermiWidget - Terminal-like Widget for iOS 14, made with Scriptable.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: orange; icon-glyph: quote-right;
// Change these to your usernames!
const user = "spencer"
const jike = "4DDA0425-FB41-4188-89E4-952CA15E3C5E"
const telegram = "realSpencerWoo"
const github = "spencerwooo"
@definiteIymaybe
definiteIymaybe / compare-files.js
Created December 2, 2022 03:43 — forked from loilo/compare-files.js
Compare File Lists in Node.js
import revHash from 'rev-hash'
import { readFileSync, statSync } from 'fs'
import { resolve } from 'path'
/**
* Calculate the rev hash for a file
*
* @param {string} file The path to the file to hash
* @returns {string}
*/
@definiteIymaybe
definiteIymaybe / postgresql-copy-csv-import-export.md
Created August 29, 2022 23:48 — forked from zaiste/postgresql-copy-csv-import-export.md
Using PostgreSQL's COPY to import & export CSV files

Using PostgreSQL's COPY to import & export CSV files

COPY can read/write data not only from/to CSV, but also from/to binary files. For the import, the table must exist along with its columns matching CSV columns.

Export table to CSV

COPY <table> TO 'file.csv' DELIMITER ',' CSV HEADER; 
@definiteIymaybe
definiteIymaybe / osxvpnrouting.markdown
Created March 29, 2022 10:57 — forked from taldanzig/osxvpnrouting.markdown
Routing tips for VPNs on OS X

Routing tips for VPNs on OS X

When VPNs Just Work™, they're a fantastic way of allowing access to a private network from remote locations. When they don't work it can be an experience in frustration. I've had situations where I can connect to a VPN from my Mac, but various networking situations cause routing conflicts. Here are a couple of cases and how I've been able to get around them.

Specific cases

Case 1: conflicting additional routes.

In this example the VPN we are connecting to has a subnet that does not conflict with our local IP, but has additional routes that conflict in some way with our local network's routing. In my example the remote subnet is 10.0.x.0/24, my local subnet is 10.0.y.0/24, and the conflicting route is 10.0.0.0/8. Without the later route, I can't access all hosts on the VPN without manually adding the route after connecting to the VPN:

@definiteIymaybe
definiteIymaybe / remove_tuxera.sh
Last active February 21, 2022 21:55 — forked from miguelmota/remove_tuxera.sh
Completely uninstall and remove Tuxera NTFS on MacOS (resets trial version)
launchctl unload /Library/LaunchAgents/com.tuxera.ntfs.agent.plist
sudo trash -Fv /Applications/Tuxera\ Disk\ Manager.app
sudo trash -Fv /Library/Application\ Support/Tuxera\ NTFS
sudo trash -Fv /Library/Filesystems/fusefs_txantfs.fs
sudo trash -Fv /Library/LaunchAgents/com.tuxera.ntfs.agent.plist
sudo trash -Fv /Library/PreferencePanes/Tuxera\ NTFS.prefPane
sudo trash -Fv /Library/Preferences/com.tuxera.NTFS.plist
@definiteIymaybe
definiteIymaybe / wget.sh
Created January 24, 2022 05:33 — forked from Dammmien/wget.sh
wget cheat sheet
# POST a JSON file and redirect output to stdout
wget -q -O - --header="Content-Type:application/json" --post-file=foo.json http://127.0.0.1
# Download a complete website
wget -m -r -linf -k -p -q -E -e robots=off http://127.0.0.1
# But it may be sufficient
wget -mpk http://127.0.0.1
# Download all images of a website
@definiteIymaybe
definiteIymaybe / jq-cheetsheet.md
Created September 9, 2021 17:46 — forked from olih/jq-cheetsheet.md
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq