Skip to content

Instantly share code, notes, and snippets.

View namndev's full-sized avatar
🏠
Working from home

Nam D. Nguyen namndev

🏠
Working from home
View GitHub Profile
@namndev
namndev / setup_ubuntu.md
Last active June 22, 2023 12:29
Things to do After Installing Ubuntu

Things to do After Installing Ubuntu

Some package for dev

sudo add-apt-repository ppa:bamboo-engine/ibus-bamboo
sudo apt update
sudo apt install vim git zsh build-essential heif-gdk-pixbuf ibus ibus-bamboo gdebi
im-config -n ibus
@namndev
namndev / ffmpeg.md
Created March 6, 2020 16:17 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@namndev
namndev / upload_large_file_s3.md
Last active March 6, 2020 05:24
Uploading a Large File to Amazon S3

The largest single file that can be uploaded into an Amazon S3 Bucket in a single PUT operation is 5 GB. If you want to upload large objects (> 5 GB), you will consider using multipart upload API, which allows to upload objects from 5 MB up to 5 TB.

The Multipart Upload API is designed to improve the upload experience for larger objects, which can be uploaded in parts, independently, in any order, and in parallel. The AWS tool to use to perform this is API-Level (s3api) command set.

In this tutorial, we assume:

  • You have installed and configured AWS Command Line Interface on a Linux OS computer/server,
  • You have an Amazon account and a S3 Bucket (MyBucketName),
  • The size of the file to upload is 681 MB (file_video.mp4),
  • 100 MB can be uploaded without problem using our internet connection.
@namndev
namndev / root_password_mysql.md
Created February 24, 2020 09:48
What is the default root pasword for MySQL 5.7

With special credit to this answer for digging me out of the frustration on this ...

$ sudo apt install mysql-server
$ sudo cat /etc/mysql/debian.cnf

Note the lines which read:

@namndev
namndev / common-google-cloud-api.md
Created February 24, 2020 07:45
Commands and other notes about Google Cloud API

kubernetes

  • Getting Started
  • how to run mongodb on kubernetes
  • create cluster gcloud container clusters create <cluster_name> --num-nodes=2 --project=<project_name> --zone=us-east1-b
  • get credentials in local after cluster created gcloud container clusters get-credentials <cluster_name> --project=<project_name> --zone=us-east1-b
  • basic yaml setup that can be used in other project git clone https://github.com/thesandlord/mongo-k8s-sidecar.git
  • for database replication need StorageClass a Headless Service and a StatefulSet
  • deploy StorageClass for database setup kubectl apply -f googlecloud_ssd.yaml
  • deploy StatefulSet kubectl apply -f mongo-statefulset.yaml
  • mongodb k8s sidecar https://github.com/cvallance/mongo-k8s-sidecar

I have a sample.mpg mpegts file with a video keyframe starting at 65738.512389

$ ffprobe -hide_banner -loglevel fatal sample.mpg -select_streams v -print_format json -show_packets -read_intervals "%+#1"
{
    "packets": [
        {
            "codec_type": "video",
            "stream_index": 0,
            "pts": 5916466115,
@namndev
namndev / create-vod-hls.sh
Created October 31, 2019 12:45
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)
#!/usr/bin/env bash
set -e
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1
# comment/add lines here to control which renditions would be created
renditions=(
# resolution bitrate audio-rate
@namndev
namndev / Trick xCode.md
Created October 29, 2019 06:59
Using iOS 13.2 devices with Xcode 11.1 (instead of Xcode 11.2) (also, Xcode 10.3)

// The trick is to link the DeviceSupport folder from the beta to the stable version.

// sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)

// Support iOS 13.2 devices (Xcode 11.2) with Xcode 11.1:

sudo ln -s /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.2 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
@namndev
namndev / Reference_iOS.md
Created October 25, 2019 07:10
52 people every iOS developer should follow on Twitter.

52 people every iOS developer should follow on Twitter.

A lot of iOS specialists — developers, designers, Apple employees, bloggers, trendsetters — has Google+ accounts, some of them has also Facebook profiles/pages, but the real vast majority of our community use Twitter as a main (and often as the only one) social media channel.

For every iOS developer, Twitter is the place to be and to get the latest hot news from the iOS world.

1.Tim Cook

Needless to say, CEO of Apple, the boss of bosses.