Skip to content

Instantly share code, notes, and snippets.

View nmvuong92's full-sized avatar
🎯
Focusing

Vượng Nguyễn nmvuong92

🎯
Focusing
View GitHub Profile
@ebidel
ebidel / handle_file_upload.php
Created April 18, 2012 03:23
Uploading files using xhr.send(FormData) to PHP server
<?php
$fileName = $_FILES['afile']['name'];
$fileType = $_FILES['afile']['type'];
$fileContent = file_get_contents($_FILES['afile']['tmp_name']);
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent);
$json = json_encode(array(
'name' => $fileName,
'type' => $fileType,
'dataUrl' => $dataUrl,
@alexpchin
alexpchin / Add_Existing_Project_To_Git.md
Created June 1, 2014 20:14
Add Existing Project To Git Repo

#Adding an existing project to GitHub using the command line

Simple steps to add existing project to Github.

1. Create a new repository on GitHub.

In Terminal, change the current working directory to your local project.

##2. Initialize the local directory as a Git repository.

git init
@4sskick
4sskick / 'let' + 'const' equivalent in ES5
Created September 4, 2016 20:36
'let' + 'const' equivalent in ES5
As we knew that 'let & const' are not coming in ES5, those are coming in ES6 since 2015.
So to make these work like in latest version ECMA Scripts 2015, we can define it by ourself.
'const' - ES6
const a = 1;
'const' - ES5
var a = (function(){
var a = 1;
return function(){
@edsiper
edsiper / kubernetes_commands.md
Last active August 16, 2024 07:29
Kubernetes Useful Commands
@abhilash1in
abhilash1in / user-data.sh
Created April 24, 2018 17:06
Install nvm and NodeJS using AWS EC2 user data script
#!/bin/bash
apt-get -y update
cat > /tmp/subscript.sh << EOF
# START UBUNTU USERSPACE
echo "Setting up NodeJS Environment"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.9/install.sh | bash
echo 'export NVM_DIR="/home/ubuntu/.nvm"' >> /home/ubuntu/.bashrc
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> /home/ubuntu/.bashrc
# Dot source the files to ensure that variables are available within the current shell
. /home/ubuntu/.nvm/nvm.sh
@matwerber1
matwerber1 / ec2-node-amzn.sh
Created September 26, 2018 02:57 — forked from ogckw/ec2-node-amzn.sh
ec2-amazon-linux-node-userdata
#!/bin/bash
# Program:
# EC2 initially install node.js, git for development environment.
# You can modify nodev and nvmv for changing node and nvm version.
# Set permission to ec2-user install above.
# History:
# 2017/07/25 Hans First release
home=/home/ec2-user
nodev='8.11.2'
nvmv='0.33.11'
@nmvuong92
nmvuong92 / golang s3 download with progressbar.go
Last active September 26, 2024 12:09
golang s3 download with progressbar
package awss3
import (
"context"
"crypto/tls"
"fmt"
"io"
"net/http"
"os"
"path/filepath"