Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🏎💨

Stefan Pettersson stpe

💭
🏎💨
  • Willa
  • Stockholm, Sweden
  • Twitter @stpe
View GitHub Profile
@stpe
stpe / clearbit-signature-validation.ts
Created May 28, 2020
How to calculate Clearbit API webhook X-Request-Signature in Node.js / JavaScript / TypeScript
View clearbit-signature-validation.ts
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)
View Mailchimp API lists result
{
"lists": [
{
"id": "2265d00fe6",
"web_id": 57533,
"name": "Västerorts RC Sportklubb",
"contact": {
"company": "Västerorts RC Sportklubb",
"address1": "Kyrkhamnsvägen 1",
"address2": "",
View bitly_api_get_clicks_batch.sh
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
View bitly_api_get_clicks.sh
curl -X GET \
 https://api-ssl.bitly.com/v4/bitlinks/bit.ly%2F2Km4Nro/clicks/summary \
 -H 'Authorization: Bearer ad7ecf6cd10e8f072651f00cf90e2bc983a4a974'
View bitly_api_create_bitlinks_batch.sh
View bitly_api_create_bitlink.sh
@stpe
stpe / bitly_get_access_token.sh
Last active Feb 29, 2020
Bitly Get Access Token
View bitly_get_access_token.sh
curl -u "myemail@domain.com:xyz123mypassword" -X POST "https://api-ssl.bitly.com/oauth/access_token"
View youtube_countries.json
{
"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 Jan 26, 2017
Youtube Audio Languages
View youtube_audioLanguages.json
{
"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 Oct 15, 2021
YouTube Video Categories JSON array
View youtube_videoCategories.json
[
{
"id": "1",
"title": "Film & Animation"
},
{
"id": "2",
"title": "Autos & Vehicles"
},
{