Skip to content

Instantly share code, notes, and snippets.

View knorwood's full-sized avatar

Kurtis Norwood knorwood

  • Amplitude
  • San Francisco, CA
View GitHub Profile
@knorwood
knorwood / send_to_batch.py
Created September 5, 2018 01:30
Sending data to Amplitude's Batch Endpoint
"""
Sending a payload of events to the /batch endpoint using the requests library.
"""
import json
import requests
# Be cautious when setting your API key and running this script since it will send the following
# two events to your app!
API_KEY = 'YOUR_API_KEY_HERE'
EVENTS = [
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowListingOfDataFolder",
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
@knorwood
knorwood / Sending events to Amplitude concurrently (Example)
Created July 25, 2017 22:41
Sending events to Amplitude concurrently (Example)
from concurrent.futures import ThreadPoolExecutor
import json
import logging
import requests
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
logging.getLogger().addHandler(handler)
logging.getLogger().setLevel(logging.INFO)
@knorwood
knorwood / Sending data to Amplitude's HTTP API (Example)
Last active July 25, 2017 22:41
Sending data to Amplitude's HTTP API (Example)
import requests
import json
import urllib
# Be cautious when setting your API key and running this script since it will send the following
# two events to your app!
API_KEY = 'YOUR API KEY HERE'
events = [
{'user_id': 'Alice', 'event_type': 'hello world'},
{'user_id': 'Bob', 'event_type': 'hello world'},
-- hmincrby for redis
--
-- Usage:
-- redis-cli EVAL "$(cat hmincrby.lua)" 1 key field1 num1 field2 num2 ... fieldn numn
if 1 ~= table.getn(KEYS) then
error("Must have exactly 1 key")
end
if 0 ~= table.getn(ARGV) % 2 then
@knorwood
knorwood / keybase.md
Created February 5, 2016 04:50
keybase.md

Keybase proof

I hereby claim:

  • I am knorwood on github.
  • I am kortox (https://keybase.io/kortox) on keybase.
  • I have a public key whose fingerprint is 37BC DC0D 5608 1971 92EF CD9B 9507 65A7 F8F9 29A8

To claim this, I am signing this object: