Skip to content

Instantly share code, notes, and snippets.

@eddanger
eddanger / basecamp2github.rb
Created December 8, 2011 05:23 — forked from chip/basecamp2github.rb
Convert Basecamp tasks to Github issues
require 'rubygems'
require 'active_resource'
require 'basecamp'
require 'httparty'
require 'json'
GITHUB_USERNAME = '__GITHUB_USERNAME__'
GITHUB_PASSWORD = '__GITHUB_PASSWORD__'
GITHUB_ORG = '__GITHUB_ORG__'
GITHUB_REPO = '__GITHUB_REPO__'
@simonw
simonw / recover_source_code.md
Last active May 17, 2024 16:13
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
@jbransen
jbransen / a-transip-zone-export.php
Last active May 17, 2024 16:08
Exporting a DNS Zone file from the TransIP API
<?php
require __DIR__ . '/vendor/autoload.php';
use Badcow\DNS\Zone;
use Badcow\DNS\Rdata\Factory;
use Badcow\DNS\ResourceRecord;
use Badcow\DNS\AlignedBuilder;
// Login details, fill those in with your TransIP username, the file containing
// your private key, and the domain you would like to export
Transip_ApiSettings::$login = "<username>";
@sagamantus
sagamantus / zerodha_request_token.py
Last active May 17, 2024 16:06
Automating the process of obtaining a request token for the Kite Connect API using the provided credentials and the KiteConnect library.
import requests
import re
import onetimepass as otp
from urllib.parse import urlparse, parse_qs
from kiteconnect import KiteConnect
def get_request_token(credentials: dict) -> str:
"""Use provided credentials and return request token.
# 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;