Skip to content

Instantly share code, notes, and snippets.

@joelvh
joelvh / .bash_profile
Last active January 14, 2020 21:04
Install Mac software updates, apps and Homebrew dependencies via command line script
### iTerm ###
# See https://www.iterm2.com/3.3/documentation-scripting-fundamentals.html
function iterm2_print_user_vars() {
iterm2_set_user_var phpVersion $(php -v | awk '/^PHP/ { print $2 }')
iterm2_set_user_var rubyVersion $(ruby -v | awk '{ print $2 }')
iterm2_set_user_var nodeVersion $(node -v)
}
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
@mayneyao
mayneyao / notion2blog.js
Last active November 29, 2025 23:34
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@tzmartin
tzmartin / m3u8-to-mp4.md
Last active November 22, 2025 20:15
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
<!DOCTYPE html>
<html>
<head>
<title>Gist for Keen IO JS Library</title>
<script src="http://d26b395fwzu5fz.cloudfront.net/3.0.0/keen.min.js"></script>
<script>
var client = new Keen({
projectId: "5368fa5436bf5a5623000000",
readKey: "3f324dcb5636316d6865ab0ebbbbc725224c7f8f3e8899c7733439965d6d4a2c7f13bf7765458790bd50ec76b4361687f51cf626314585dc246bb51aeb455c0a1dd6ce77a993d9c953c5fc554d1d3530ca5d17bdc6d1333ef3d8146a990c79435bb2c7d936f259a22647a75407921056"
@rebeccastandig
rebeccastandig / gist:8968570
Created February 13, 2014 02:18
How to generate a line chart for conversion analysis with Keen IO
<script type="text/javascript" charset="utf-8">
// Global Properties for Line Chart Viz
var chartHeight = 400
var chartWidth = 600
var lineWidth = 3
var chartAreaWidth = "60%"
var chartAreaLeft = "10%"
var xAxisLabelAngle = "45%"
@rebeccastandig
rebeccastandig / retention_line_chart.js
Last active October 25, 2017 21:03
How to generate a line chart for retention analysis with Keen IO
<script type="text/javascript" charset="utf-8">
// Global Properties for Line Chart Viz
var chartHeight = 400
var chartWidth = 600
var lineWidth = 3
var chartAreaWidth = "60%"
var chartAreaLeft = "10%"
var xAxisLabelAngle = "45%"
@laracasts
laracasts / gulpfile.js
Last active February 10, 2024 10:57
Example Laravel-specific Gulpfile from Laracasts.com
var gulp = require('gulp');
var gutil = require('gulp-util');
var notify = require('gulp-notify');
var sass = require('gulp-ruby-sass');
var autoprefix = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css')
var coffee = require('gulp-coffee');
var exec = require('child_process').exec;
var sys = require('sys');
# First, Install Vagrant and Virtualbox then:
# Create new project directory
mkdir -p ~/Sites/newproject # Create new project directory
mk ~/Sites/newproject # Go into your new project directory
# Setup Vagrant
vagrant init
# Edit vagrant file box and box url to install Ubuntu, just like https://gist.github.com/fideloper/dab171a2aa646e86b782#file-vagrantfile-share-var-www-rb-L6-L8
# Edit Vagrantfile to create a static IP address, just like https://gist.github.com/fideloper/dab171a2aa646e86b782#file-vagrantfile-share-var-www-rb-L10
@fideloper
fideloper / install.sh
Last active October 30, 2023 20:03
Vagrant Provisioning Script for PHP applications. This installs a LAMP stack.
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@wetzler
wetzler / gist:6909882
Last active May 16, 2020 13:13
This gist shows you how to run a retention analysis. I blogged about how to run a retention analysis here: https://keen.io/blog/47823687779/how-to-do-a-retention-analysis/
require 'rubygems'
require 'keen'
require 'json'
require 'date'
require 'active_support/all' #for datetime calculation e.g. weeks.ago.at_beginning_of_week
require 'simple_xlsx' #for outputting excel files
require 'cgi' #for URL encoding
#================================oOo===================================