Skip to content

Instantly share code, notes, and snippets.

@tuliren
tuliren / show_wallpaper_on_desktop.md
Created August 11, 2023 04:12
Commands to show or hide wallpaper filename on Mac desktop
# show
defaults write com.apple.dock desktop-picture-show-debug-text -bool TRUE  && killall Dock
# hide
defaults write com.apple.dock desktop-picture-show-debug-text -bool FALSE  && killall Dock
@tuliren
tuliren / partialTypePredicate.ts
Last active July 18, 2023 23:25
Partial Type Predicate in TypeScript
interface Base {
base1: string;
base2: string;
a: string;
}
interface Interface1 extends Base {
b: number;
}
#!/usr/bin/env bash
set -euo pipefail
set -x
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "${ROOT_DIR}"
SOURCE_CONFIG_URL="https://raw.githubusercontent.com/airbytehq/airbyte/master/airbyte-integrations/connectors/source-file/integration_tests/config.json"
SOURCE_IMAGE_NAME="airbyte/source-file"
  • Install Ruby with openssl 1.0

    brew switch openssl 1.0.2s
    export PATH="/usr/local/opt/openssl@1.0/bin:$PATH"
    export LDFLAGS="-L/usr/local/opt/openssl@1.0/lib ${LDFLAGS}"
    export CPPFLAGS="-I/usr/local/opt/openssl@1.0/include ${CPPFLAGS}"
    RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s/ rbenv install 2.3.0
  • Fix and use libxml2

@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 */
}

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 / 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
# 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 / 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:

@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