Skip to content

Instantly share code, notes, and snippets.

View sethmills21's full-sized avatar

Seth Miller sethmills21

View GitHub Profile
const { google } = require("googleapis");
const fs = require("fs");
// You need to go to Google Cloud console (console.cloud.google.com), then APIs
// & Services -> Credentials. There, create a new service account (or reuse
// existing if you have one). Click on a service account, go to Keys, and create
// a new key, and download JSON for it. You'll use path to that JSON for
// SERVICE_ACCOUNT_FILE var.
//
// Then, go to Google Play Console, then "Users and Permissions" on the left
@MartinWeiss12
MartinWeiss12 / spotifyArtistGrid.py
Last active January 4, 2024 05:10
Get Artist Image URL With Spotify API
artistImageUrlList = []
print('Total artists streamed:', len(uniqueArtistUriList))
for uri in range(49):
spotifyUrl = requests.get('https://open.spotify.com/artist/' +
str(uniqueArtistUriList[uri]))
spoifyHtmlData = str(soup(spotifyUrl.text, 'html.parser'))
spoifyHtmlData = spoifyHtmlData.split('<')
artistName = spoifyHtmlData[5].split('>')
artistName = artistName[1].split('|')
artistApiResults = requests.get('https://api.spotify.com/v1/search',
@markusand
markusand / logger.js
Created January 15, 2022 18:33
Express logger module with Winston + Morgan
import winston from 'winston';
import morgan from 'morgan';
import json from 'morgan-json';
/* WINSTON */
const filterLevel = level => winston.format(info => info.level === level ? info : undefined)();
const logger = winston.createLogger({
levels: { error: 0, warn: 1, info: 2, debug: 3, http: 4 },
transports: [
@gauravkeshre
gauravkeshre / readme.md
Last active August 21, 2023 18:03
iOS Cocoa Touch Universal Framework Script

iOS Cocoa Touch Universal Framework Script

What

For an framework to be compatible with various devices it has to be compiled for them specifically, This script does those tasks in single shot.

How

Install Script

  1. Select Target
@drakeguan
drakeguan / convert_mp4_to_caf_opus.sh
Last active October 14, 2020 22:18
Extract audio track, convert to CAF/Opus, and generate a RSS2 feed for personal hosting podcast!
#!/bin/bash
ffmpeg -y -i "$f" -vn -c:a libfdk_aac -b:a 128k "audio/$(basename $f .mp4).m4a"
afconvert -f caff -d opus -b 8000 "audio/$(basename $f .mp4).m4a" "opus/$(basename $f .mp4).caf"
extension UIViewController {
var compatibleSafeInsets: UIEdgeInsets {
if #available(iOS 11, *) {
return view.safeAreaInsets
} else {
return UIEdgeInsetsMake(topLayoutGuide.length, 0, bottomLayoutGuide.length, 0)
}
}
}
@mjurincic
mjurincic / nginx.conf
Last active June 30, 2022 16:05 — forked from tomysmile/node-setup-pm2-nginx.md
Setup NodeJS Production with PM2, Nginx on AWS Ubuntu 16.04 server
proxy_http_version 1.1;
proxy_set_header Connection "";
https://gist.github.com/miguelmota/6912559
# The upstream module is the link between Node.js and Nginx.
# Upstream is used for proxying requests to other servers.
# All requests for / get distributed between any of the servers listed.
upstream helloworld {
# Set up multiple Node.js webservers for load balancing.
# max_fails refers to number of failed attempts
# before server is considered inactive.
@teocci
teocci / compile_ffmpeg.md
Last active December 18, 2022 00:15
Compile FFmpeg on Ubuntu 16.04

Compile FFmpeg on Ubuntu

This basic guide supports Ubuntu Xenial Xerus 16.04 and will enable several external encoding and decoding libraries: libfaac (AAC encoder), libfdk-aac (AAC encoder), libmp3lame (MP3 encoder), libopencore-amr (AMR encoder/decoder), librtmp (for additional RTMP protocols), libtheora (Theora encoder), libvorbis (Vorbis encoder), libvpx (VP8 encoder/decoder), and libx264 (H.264 encoder). These are optional and may be omitted if desired. This guide will also install many filters (see the filter list in the [Filtering Guide][1].

Note: Copy and paste the whole code box for each step.

Preparation

- (void)fixVideoUrl:(NSURL *)url completion:(void (^)(NSURL *outputUrl))completion {
// output file
NSString* docFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString* outputPath = [docFolder stringByAppendingPathComponent:@"output2.mov"];
if ([[NSFileManager defaultManager] fileExistsAtPath:outputPath]) {
[[NSFileManager defaultManager] removeItemAtPath:outputPath error:nil];
}
// input file
AVAsset* asset = [AVAsset assetWithURL:url];
@gbitaudeau
gbitaudeau / Int+Extenstion.swift
Created March 3, 2017 09:44
iOS solution to convert large numbers to smaller format. See : http://stackoverflow.com/a/35504720/1661338
extension Int {
func formatUsingAbbrevation () -> String {
let numFormatter = NSNumberFormatter()
typealias Abbrevation = (threshold:Double, divisor:Double, suffix:String)
let abbreviations:[Abbrevation] = [(0, 1, ""),
(1000.0, 1000.0, "K"),
(100_000.0, 1_000_000.0, "M"),
(100_000_000.0, 1_000_000_000.0, "B")]