Skip to content

Instantly share code, notes, and snippets.

View naviocean's full-sized avatar
🌴
On vacation

Duong Le naviocean

🌴
On vacation
View GitHub Profile
@naviocean
naviocean / openresty-ubuntu-install.sh
Last active July 14, 2017 23:51 — forked from alex-roman/openresty-ubuntu-install.sh
Easy install openresty (used and tested on Ubuntu 14.04, 15.10 and 16.04)
#!/bin/bash
apt-get -y update
apt-get -y install nginx-extras build-essential libpcre3-dev libssl-dev libgeoip-dev libpq-dev libxslt1-dev libgd2-xpm-dev
wget -c https://openresty.org/download/openresty-1.11.2.4.tar.gz
tar zxvf openresty-1.11.2.4.tar.gz
cd openresty-1.11.2.4
./configure \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
@naviocean
naviocean / classifier_from_little_data_script_3.py
Created July 27, 2018 08:37 — forked from fchollet/classifier_from_little_data_script_3.py
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
@naviocean
naviocean / ubuntu-cuda-caffe.Dockerfile
Last active October 11, 2018 08:44 — forked from jcboyd/ubuntu-cuda-caffe.Dockerfile
Dockerfile for ubuntu 16.04 + CUDA 8.0 + Caffe for deep learning
# $ nvida-docker run -it naviocean/convert
# Download base image
FROM ubuntu:16.04
# Set environment variables
ENV PATH "/usr/local/cuda-8.0/bin:$PATH"
ENV LD_LIBRARY_PATH "/usr/local/cuda-8.0/lib:$LD_LIBRARY_PATH"
# Set keyboard configuration in advance of installing CUDA
@naviocean
naviocean / install-cuda-10-bionic.sh
Created February 14, 2019 08:33 — forked from bogdan-kulynych/install-cuda-10-bionic.sh
Install CUDA 10 on Ubuntu 18.04
#!/bin/bash
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub && sudo apt update
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt update
sudo apt install -y cuda
@naviocean
naviocean / pytorch_setup.sh
Last active May 28, 2019 03:23 — forked from kylemcdonald/pytorch_setup.sh
Install CUDA 9.2, cuDNN 7.2.1, Anaconda and PyTorch on Ubuntu 16.04.
# tested on AWS p2.xlarge August 29, 2018
# install CUDA
sudo apt-get update && sudo apt-get install wget -y --no-install-recommends
CUDA_URL="https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda-repo-ubuntu1604-9-2-local_9.2.148-1_amd64"
wget -c ${CUDA_URL} -O cuda.deb
sudo dpkg --install cuda.deb
sudo apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install -y cuda
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@naviocean
naviocean / multiple_ssh_setting.md
Created September 3, 2019 04:50 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@naviocean
naviocean / arm_opencv_install.sh
Last active May 14, 2020 11:58 — forked from kochie/install.sh
A updated installation of OpenCV on Ubuntu 17.04. Also provides command line argument to compile ARM binaries aimed at Raspberry Pi
#!/bin/bash
VERSION=3.3.0
PYTHON=/usr/bin/python3
if [ $1 == "arm" ]; then
echo "Compiling for ARM (Raspberry Pi)"
sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install gcc-arm-linux-gnueabihf
@naviocean
naviocean / nginx-tuning.md
Created August 31, 2021 15:35 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@naviocean
naviocean / docker-cleanup
Created September 10, 2021 06:32 — forked from wdullaer/docker-cleanup
Cleanup unused Docker images and containers
#!/bin/sh
# Cleanup docker files: untagged containers and images.
#
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}'