Skip to content

Instantly share code, notes, and snippets.

View davidborzek's full-sized avatar

David Borzek davidborzek

View GitHub Profile
@davidborzek
davidborzek / ffmpeg_decode_audio.c
Last active June 12, 2024 02:22
FFMPEG: Decode audio to raw PCM file
// Build flags: -lavcodec -lavformat -lavutil -lswresample
#include <stdio.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
#include <libswresample/swresample.h>
int main(int argc, char **argv) {
@davidborzek
davidborzek / spotify-ws.js
Created August 6, 2021 12:48
Access the spotify websocket api for real time updates about playback etc. Only works with an offical access token, third-party ones don't work.
import axios from 'axios';
import WebSocket from 'ws';
/*
Use a spotify acces token from an offical source like open.spotify.com. You can obtain it by using the network inspector in your browser.
Third-party access token obtained via OAuth2 will not work because of an api limitation by spotify.
*/
const ACCESS_TOKEN = "";
const createWebSocketUrl = (accessToken) => `wss://dealer.spotify.com/?access_token=${accessToken}`;