Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View stpe's full-sized avatar
👋
🏎💨

Stefan Pettersson stpe

👋
🏎💨
View GitHub Profile
@stpe
stpe / clearbit-signature-validation.ts
Created May 28, 2020 09:32
How to calculate Clearbit API webhook X-Request-Signature in Node.js / JavaScript / TypeScript
import * as crypto from 'crypto';
export class ClearbitSignatureValidation {
static getSignature(raw_body: string, signature: string): string {
const signature_without_prefix = signature.replace(/^(sk\_)/, '');
return (
'sha1=' +
crypto
.createHmac('sha1', signature_without_prefix)
@stpe
stpe / Mailchimp API lists result
Created July 7, 2019 16:06
Mailchimp /lists result
{
"lists": [
{
"id": "2265d00fe6",
"web_id": 57533,
"name": "Västerorts RC Sportklubb",
"contact": {
"company": "Västerorts RC Sportklubb",
"address1": "Kyrkhamnsvägen 1",
"address2": "",
xargs -n 1 -I{} \
 sh -c " \
 curl -s -X GET \
 https://api-ssl.bitly.com/v4/bitlinks/bit.ly%2F2{}/clicks/summary \
 -H 'Authorization: Bearer ad7ecf6cd10e8f072651f00cf90e2bc983a4a974' \
 | jq .total_clicks" \
< shortlinks.txt
curl -X GET \
 https://api-ssl.bitly.com/v4/bitlinks/bit.ly%2F2Km4Nro/clicks/summary \
 -H 'Authorization: Bearer ad7ecf6cd10e8f072651f00cf90e2bc983a4a974'
@stpe
stpe / bitly_get_access_token.sh
Last active September 4, 2023 19:11
Bitly Get Access Token
curl -u "myemail@domain.com:xyz123mypassword" -X POST "https://api-ssl.bitly.com/oauth/access_token"
@stpe
stpe / youtube_countries.json
Created January 26, 2017 16:08
YouTube Countries
{
"AF": "Afghanistan",
"AX": "Aland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
@stpe
stpe / youtube_audioLanguages.json
Created January 26, 2017 16:03
Youtube Audio Languages
{
"zxx": "Not applicable",
"ab": "Abkhazian",
"aa": "Afar",
"af": "Afrikaans",
"sq": "Albanian",
"ase": "American Sign Language",
"am": "Amharic",
"ar": "Arabic",
"arc": "Aramaic",
@stpe
stpe / youtube_videoCategories.json
Last active October 15, 2021 06:20
YouTube Video Categories JSON array
[
{
"id": "1",
"title": "Film & Animation"
},
{
"id": "2",
"title": "Autos & Vehicles"
},
{