Skip to content

Instantly share code, notes, and snippets.

@richard512
richard512 / standing-with-balls.txt
Created September 17, 2015 19:33
Standing with balls. Look of disapproval.
ಠ_ಠ
<|>
/ω\
@richard512
richard512 / prepare_icons.sh
Created September 18, 2015 17:27
a bash script for prepping icons for android, chrome, apple ios iphone ipad, microsoft, and maybe other mobile devices. make icon once and generates for all devices.
#!/bin/bash
base=$1
function prepimg {
echo "prepping $2 $3"
convert "$1" -flatten -resize "$3" -unsharp 1x4 "$2"
}
mkdir -p mipmap-ldpi/
mkdir -p mipmap-mdpi/
@richard512
richard512 / yogafixer.sh
Last active September 21, 2015 04:30
ubuntu fixes for yoga 11s wifi and bluetooth
sudo apt-get install git build-essential linux-headers-generic linux-headers-$(uname -r)
git clone https://github.com/lwfinger/rtl8723au.git
cd rtl8723au/
make
sudo make install
sudo modprobe -r r8723au
sudo modprobe 8723au
cd ..
@richard512
richard512 / ffmpeg-convert.sh
Last active December 22, 2022 01:45
ffmpeg merge and convert between webm, wav, and opus
#/bin/bash
# ffmpeg convert wav audio to opus audio
ffmpeg -i uploads/audio.wav -c:a opus -strict -2 -y uploads/output.opus
# ffmpeg combine webm and wav into a new webm with opus audio
ffmpeg -i uploads/video.webm -i uploads/audio.wav -c:a opus -strict -2 -y uploads/output.webm
@richard512
richard512 / online-video.md
Last active September 7, 2016 06:46
Code related to online video upload / download / streaming / conversion / UI
@richard512
richard512 / how-youtube-works.md
Last active December 23, 2022 17:42
How Youtube HTML5 Audio+Video Streaming Works - by Nick Vogt

How YouTube Streams Video & Audio

Posted Nov 20, 2014 by Nick Vogt

This is a technical post on how the YouTube player works, including the kinds of http requests it makes and how it streams video and audio. This information was researched with the HTML5 player, but may be applicable to the Flash player as well. The HTML5 player uses JavaScript and is the default player for Chrome and newer Internet Explorer.

Get YouTube Video Info

When the YouTube video player is started, either on a youtube.com page or an embed, it first sends a request to http://www.youtube.com/get_video_info with about 13 query string parameters. These parameters contain information such as the video ID, the player width/height, and what host is requesting the video. 

@richard512
richard512 / sms.sh
Last active November 16, 2021 20:44
Send SMS Text Messages via ADB Android Debugger on Linux
#/bin/bash
phonenum="+10000000000"
smsbody="hello world"
# use adb to say "start the app we use for SMS"
# with the following information
adb shell am start \
-a android.intent.action.SENDTO \
-d sms:"$phonenum" \
@richard512
richard512 / click-anywhere-to-start-recording.html
Created September 7, 2016 02:26
Video Box - "Click anywhere to start recording"
<!DOCTYPE html>
<meta name="robots" content="noindex">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Video Box</title>
<style id="jsbin-css">
#videobox {
@richard512
richard512 / importgeoip.sh
Last active September 7, 2016 03:06
Grab GeoIP CSV file and import into MySQL
#/bin/bash
wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip
unzip GeoLite2-City-CSV.zip
# TODO: do fancy magics for importing into mysql
# something like this:
mysqlimport --ignore-lines=1 \
--fields-terminated-by=, \
@richard512
richard512 / csv2sql.php
Created September 9, 2016 19:19
CSV to MySQL via PHP - Reads a CSV file and guesses a mildly appropriate MySQL table structure
<?php
$maxrows = 500;
if (!isset($argv[1])) {
echo "\n"."csv2sql.php"."\n";
echo "What this does: Reads a CSV file"."\n";
echo "and guesses a mildly appropriate"."\n";
echo "MySQL table structure"."\n\n";
echo "Usage: php csv2sql.php something.csv"."\n\n";