Skip to content

Instantly share code, notes, and snippets.

View AshKyd's full-sized avatar
🐳
a frood who really knows where his towel is

Ash Kyd AshKyd

🐳
a frood who really knows where his towel is
View GitHub Profile
@AshKyd
AshKyd / eslintrc.json
Last active August 15, 2017 05:12
Airbnb linting: Quick script to set up airbnb linting in a project.
{
"extends": "airbnb",
"env": {
"browser": true,
"node": true,
"jquery": true
},
"globals": {
"ABC": true
}
@AshKyd
AshKyd / setup.sh
Last active January 29, 2019 11:55
Mocha tests: Quick script to set up mocha testing in a project.
#!/bin/bash
# Install mocha in the background
npm install mocha --save-dev
# Make test folder & add a sample test
mkdir -p test/data
curl https://gist.githubusercontent.com/AshKyd/0275db246644b1f4616abf4eea9b07cb/raw/test.js?`date +%s` > test/index.js
# Add test command to npm scripts
@AshKyd
AshKyd / the problem.md
Last active December 14, 2017 10:41
Eventbrite venue API

I'm trying to fetch venues for events.

  1. I have successfully fetched a list of events via: https://www.eventbriteapi.com/v3/events/search/?location.within=50km&location.latitude=-27.466667&location.longitude=153.033333&&categories=102&token=mytoken
  2. I am attempting to fetch the venues from the events[].venue_id in this payload via https://www.eventbriteapi.com/v3/venues/22155649/?token=mytoken
  • What I'd expect: an event payload to be returned.
  • What I'm seeing: HTTP 403 FORBIDDEN

It looks (from this thread) as if this is a longstanding issue whereby events are public but venues are not.

@AshKyd
AshKyd / gifenc.sh
Last active February 6, 2018 23:59
Gif encoder script
#!/bin/sh
# Use ./gifenc.sh input.mp4 output.gif
palette="/tmp/palette.png"
## Adjust start time and duration
# -ss 00:00:03 -t 00:00:08
# Various filters change framerate, crop, scaling etc
#filters="crop=320:320:500:100,fps=16"
(function() {
var ads = Array.from(document.querySelectorAll('path[d="M20.75 2H3.25A2.25 2.25 0 0 0 1 4.25v15.5A2.25 2.25 0 0 0 3.25 22h17.5A2.25 2.25 0 0 0 23 19.75V4.25A2.25 2.25 0 0 0 20.75 2zM17.5 13.504a.875.875 0 1 1-1.75-.001V9.967l-7.547 7.546a.875.875 0 0 1-1.238-1.238l7.547-7.547h-3.54a.876.876 0 0 1 .001-1.751h5.65c.483 0 .875.39.875.874v5.65z"]')).map(path => {
try {
return path.parentNode.parentNode.parentNode.parentNode.querySelector('path[d="M20.207 7.043a1 1 0 0 0-1.414 0L12 13.836 5.207 7.043a1 1 0 0 0-1.414 1.414l7.5 7.5a.996.996 0 0 0 1.414 0l7.5-7.5a1 1 0 0 0 0-1.414z"]').parentNode.parentNode.parentNode;
} catch (e) {
console.log('couldnt', path);
return null;
}
});
@AshKyd
AshKyd / gist:8dfda35cd0d1c01559a8e85122201863
Created June 1, 2018 03:54
Messenger webview user agents
Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E302 [FBAN/MessengerForiOS;FBAV/167.0.0.57.96;FBBV/109575372;FBDV/iPhone7,1;FBMD/iPhone;FBSN/iOS;FBSV/11.3.1;FBSS/3;FBCR/Telstra;FBID/phone;FBLC/en_GB;FBOP/5;FBRV/0]
Mozilla/5.0 (Linux; Android 8.0.0; G3116 Build/48.1.A.0.129; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.158 Mobile Safari/537.36 [FB_IAB/Orca-Android;FBAV/167.0.0.28.94;]/FB_MEXT_IAB
@AshKyd
AshKyd / gifenc.sh
Created June 22, 2018 01:24
GIF encoding with ffmpeg
#!/bin/sh
palette="/tmp/palette.png"
#crop=320:240,500,300
# -ss 00:00:03 -t 00:00:08
#filters="crop=320:320:500:100,fps=16"
filters="fps=24,scale=600:-1:flags=lanczos"
#filters="fps=5"
#filters="fps=16"
@AshKyd
AshKyd / update-bash-macos.sh
Created June 15, 2019 15:56
Update MacOS bash & set default shell
brew install bash
sudo echo /usr/local/bin/bash >> /etc/shells
chsh -s /usr/local/bin/bash
(function() {
const nets = {
twitter: ['https://twitter.com/*$'],
linkedin: ['https://www.linkedin.com/company/*$', 'linkedin.com/in/*$'],
instagram: ['https://www.instagram.com/*$'],
facebook: ['https://www.facebook.com/*$'],
glassdoor: ['https://www.glassdoor.com/Reviews/*.htm$'],
github: ['https://(www.)?github.com/*$']
}
@AshKyd
AshKyd / timelapse.md
Last active October 29, 2021 06:17 — forked from alexellis/timelapse.md
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

Crop to 4k:

ffmpeg -r 30 -pattern_type glob -i '*.JPG' -s 3840:2160 -vcodec libx264 -pix_fmt yuv420p timelapse.mp4

Crop to original:

ffmpeg -r 30 -pattern_type glob -i '*.JPG' -vcodec libx264 -pix_fmt yuv420p timelapse.mp4