Skip to content

Instantly share code, notes, and snippets.

@tuliren
tuliren / ..README.md
Created July 19, 2016 19:11 — forked from gnarf/..git-pr.md
Global .gitconfig aliases for GitHub Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from GitHub remotes:

  • git pr 4 - creates local branch pr/4 from the origin remote and checks it out
  • git pr 4 upstream - creates local branch pr/4 from upstream remote and checks it out
@tuliren
tuliren / MySQL_macOS_Sierra.md
Created April 9, 2017 02:31 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.16470588743686676</real>
@tuliren
tuliren / transfor_git_file.sh
Created May 24, 2017 13:42
Transfer files between two repositories with history
# http://blog.neutrino.es/2012/git-copy-a-file-or-directory-from-another-repository-preserving-history/
mkdir /tmp/mergepatchs
cd ~/repo/org
export reposrc=myfile.c #or mydir
git format-patch -o /tmp/mergepatchs $(git log $reposrc|grep ^commit|tail -1|awk '{print $2}')^..HEAD $reposrc
cd ~/repo/dest
git am /tmp/mergepatchs/*.patch
@tuliren
tuliren / convert_video_to_gif.sh
Last active October 26, 2017 05:34
Video conversion
#!/bin/bash
for file in *.mp4
do
new_file=`echo ${file} | cut -d"." -f1`
echo "Processing: ${new_file}.mp4 -> ${new_file}.gif"
ffmpeg -i ${new_file}.mp4 -s 600x400 -r 5 -f gif - | gifsicle --optimize=1 --delay=3 > ${new_file}.gif
done
@tuliren
tuliren / GIF-Screencast-OSX.md
Created August 23, 2017 02:51 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

# Show database charset
SELECT default_character_set_name FROM information_schema.SCHEMATA
WHERE schema_name = "<database>";
# Chase database charset
ALTER DATABASE <database> CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
# Show table charset
SELECT CCSA.character_set_name, T.table_name FROM information_schema.`TABLES` T,
information_schema.`COLLATION_CHARACTER_SET_APPLICABILITY` CCSA
@tuliren
tuliren / README.md
Last active March 22, 2019 06:42
Hadoop Memory Configuration
Parameter Purpose Default
yarn.app.mapreduce.am.resource.mb The physical memory requirement, in MiB, for the ApplicationMaster. 1 GiB
mapreduce.map.memory.mb The amount of physical memory, in MiB, allocated for each map task of a job. 1 GiB
mapreduce.reduce.memory.mb The amount of physical memory, in MiB, allocated for each reduce task of a job. 1 GiB
mapreduce.map.java.opts Java opts for the map processes. -Djava.net.preferIPv4Stack=true
mapreduce.reduce.java.opts Java opts for the reduce processes. -Djava.net.preferIPv4Stack=true
mapred.child.java.opts Java opts for the map processes. It has been deprecated in Hadoop 2.0. -Djava.net.preferIPv4Stack=true
yarn.nodemanager.vmem-pmem-ratio Virtual / physical memory ratio. Virtual memory is allocated based on this ratio 2.1

Lessons from Scaling to Hundreds of Millions of Users

Tammy Butow presentation on DigitalOcean Tide SF

Before launch

  • Kubernetes
    • 3 primaries and 3 nodes
    • Docker containers
    • Load balancer
  • Private network
@tuliren
tuliren / DefaultKeyBinding.dict
Last active November 26, 2019 23:03
Mac Key Binding
{
"\UF729" = "moveToBeginningOfLine:"; /* Home */
"\UF72B" = "moveToEndOfLine:"; /* End */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
"$\UF72B" = "moveToEndOfLineAndModifySelection:"; /* Shift + End */
"\UF72C" = "moveToBeginningOfDocument:"; /* PageUp */
"\UF72D" = "moveToEndOfDocument:"; /* PageDown */
}