Skip to content

Instantly share code, notes, and snippets.

View PhouvanhKCSV's full-sized avatar
🌴
On vacation

Phouvanh KCSV PhouvanhKCSV

🌴
On vacation
View GitHub Profile
@PhouvanhKCSV
PhouvanhKCSV / handle-binary-upload-in-lambda.js
Created November 22, 2019 01:23 — forked from DavidWells/handle-binary-upload-in-lambda.js
Handle Zip uploads through lambda function
/**
* For future use
* Handle Zip uploads through lambda
*/
const AWS = require('aws-sdk')
const s3 = new AWS.S3()
const fileType = require('file-type')
const sha1 = require('sha1')
exports.handler = function(event, context) {
@PhouvanhKCSV
PhouvanhKCSV / oci8.pc
Last active October 29, 2019 07:35 — forked from fredericobenevides/oci8.pc
Setup for go-oci8
prefix=/opt/oracle
includedir=${prefix}/instantclient_12_1/sdk/include
libdir=${prefix}/instantclient_12_1
Name: oci8
Description: Oracle Instant Client
Version: 12.1
Cflags: -I${includedir}
Libs: -L${libdir} -lclntsh
@PhouvanhKCSV
PhouvanhKCSV / gist:7a46fee5ba0e595c7d4debcbc697a9b9
Created September 30, 2018 18:41 — forked from chad3814/gist:2924672
deleting array items in javascript with forEach() and splice()
// This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561
/*
* How to delete items from an Array in JavaScript, an exhaustive guide
*/
// DON'T use the delete operator, it leaves a hole in the array:
var arr = [4, 5, 6];
delete arr[1]; // arr now: [4, undefined, 6]
@PhouvanhKCSV
PhouvanhKCSV / Instructions.sh
Created June 27, 2018 13:19 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
<?php
class ReconnectingPDO
{
protected $dsn, $username, $password, $pdo, $driver_options;
public function __construct($dsn, $username = "", $password = "", $driver_options = array())
{
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
@PhouvanhKCSV
PhouvanhKCSV / index.sh
Created March 26, 2018 05:35 — forked from max-mapper/index.sh
generate ES512 and RS256 elliptic curve keypairs for JWT JWK (JSON Web Token JSON Web Key) using openssl
# RS256
# private key
openssl genrsa -out rs256-4096-private.rsa 4096
# public key
openssl rsa -in rs256-4096-private.rsa -pubout > rs256-4096-public.pem
# ES512
# private key
openssl ecparam -genkey -name secp521r1 -noout -out ecdsa-p521-private.pem
# public key
@PhouvanhKCSV
PhouvanhKCSV / jwtRS256.sh
Created March 26, 2018 05:27 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@PhouvanhKCSV
PhouvanhKCSV / nuxt.config.js
Created February 8, 2018 06:09 — forked from DiederikvandenB/nuxt.config.js
NuxtJS Sentry Module
module.exports = {
/* ... */
modules: [
['~/modules/sentry', {
public_key: '',
private_key: '',
project_id: '',
}],
],
/* ... */
@PhouvanhKCSV
PhouvanhKCSV / proxy.js
Created February 1, 2018 15:08 — forked from gouroujo/proxy.js
Proxy on /api for express app using node http-proxy
import { createProxyServer } from 'http-proxy';
import url from 'url';
import _ from 'lodash';
module.exports = app => {
const proxy = createProxyServer();
app.all('/api/v1/*', (req, res) => {
const path = _.drop(req.url.split('/'), 3);
proxy.proxyRequest(req, res, {
target: url.resolve('YOUR URL', path.join('/')),