Skip to content

Instantly share code, notes, and snippets.

# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
#!/bin/bash
# Update and upgrade Homebrew
echo "Updating Homebrew..."
brew update
brew upgrade
# Install nvm (Node Version Manager)
echo "Installing nvm..."
@moorage
moorage / gmail_batch_fetch.ts
Created August 28, 2023 21:14
How to fetch gmail in batch with javascript / typescript
const gmailBatchEndpoint = 'https://www.googleapis.com/batch/gmail/v1'
const batchLimit = 2
async function fetchFullMessages(
auth: OAuth2Client,
messageIds: string[] = []
) {
const messageQueries = messageIds.map(function (id) {
return { uri: '/gmail/v1/users/me/messages/' + id }
@robertainslie
robertainslie / submit-to-hubspot-forms-api-with-javascript.md
Last active May 17, 2024 16:01
Submitting to the HubSpot Forms API with JavaScript

Overview

This tutorial will walk you through how to submit to the HubSpot Forms API using Javascript. Check out the documentation for submitting to the Forms API.

  • It will use vanilla JS (i.e. no libraries or frameworks) and will provide example code.
  • It will assume that you are familiar with HubSpot, HubSpot Forms, and that the HubSpot Tracking Code is on the page.

A note on the HubSpot cookie: hubspotutk

The HubSpot tracking code is a javascript snippet that is placed on websites. It anonymously collects website visit data, similar to Google Analytics. This anonymous visit data can be associated to HubSpot Contact record through a few means, including sending a usertoken value when submitting data to the Forms API. The tracking code generates a cookie containing a unique usertoken called hubspotutk. The value of hubspotutk will be submitted in our form submission as hutk. HubSpot uses this cookie value to connect visito

@sora10pls
sora10pls / Titan Randomizer.cs
Last active May 17, 2024 16:01
A Randomizer for Pokémon Scarlet and Pokémon Violet
// PATHS
public const string DEST_MASTER = @"";
public const string PATH_MASTER = @"";
public const string DEST_LOG = @"";
public const string LANGUAGE = "English";
// MAXIMUMS
public const int MAX_SPECIES_ID = 1025;
public const int MAX_MOVE_ID = 919;
public const int MAX_ABILITY_ID = 310;
@simonw
simonw / recover_source_code.md
Last active May 17, 2024 16:00
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@nckroy
nckroy / eran-hammer-oauth2-rant-20120726.md
Created January 21, 2021 00:15
OAuth 2.0 and the Road to Hell

(Scraped from the Internet Wayback Machine. Original content by Eran Hammer / hueniverse.com July 26, 2012)

OAuth 2.0 and the Road to Hell

They say the road to hell is paved with good intentions. Well, that’s OAuth 2.0.

Last month I reached the painful conclusion that I can no longer be associated with the OAuth 2.0 standard. I resigned my role as lead author and editor, withdraw my name from the specification, and left the working group. Removing my name from a document I have painstakingly labored over for three years and over two dozen drafts was not easy. Deciding to move on from an effort I have led for over five years was agonizing.

There wasn’t a single problem or incident I can point to in order to explain such an extreme move. This is a case of death by a thousand cuts, and as the work was winding down, I’ve found myself reflecting more and more on what we actually accomplished. At the end, I reached the conclusion that OAuth 2.0 is a bad

@qdm12
qdm12 / README.md
Last active May 17, 2024 16:00
Wireguard and iptables restrictions for multiple users

Wireguard and iptables restrictions for multiple users

If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.

Assumptions

This should fit most setups (not mine though 😉)

@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 17, 2024 15:59
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory