Skip to content

Instantly share code, notes, and snippets.

#! /bin/bash
printf "Installing RDP Be Patience... " >&2
{
sudo useradd -m chungvh
sudo adduser chungvh sudo
echo 'chungvh:your_passwd' | sudo chpasswd
sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd
sudo apt-get update
wget https://dl.google.com/linux/direct/chrome-remote-desktop_current_amd64.deb
sudo dpkg --install chrome-remote-desktop_current_amd64.deb
@vhchung
vhchung / dbdiagram.io.dark.js
Created December 10, 2020 03:59
Enable dark theme for dbdiagram.io
// ==UserScript==
// @name Dark theme dbdiagram.io
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @icon https://cdn.holistics.io/logo-dbdiagram-notext.ico
// @author You
// @match https://dbdiagram.io/d/*
// @require https://code.jquery.com/jquery-3.4.1.min.js
// @grant none
{"swagger":"2.0","info":{"description":"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.","version":"1.0.5","title":"Swagger Petstore","termsOfService":"http://swagger.io/terms/","contact":{"email":"apiteam@swagger.io"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"host":"petstore.swagger.io","basePath":"/v2","tags":[{"name":"pet","description":"Everything about your Pets","externalDocs":{"description":"Find out more","url":"http://swagger.io"}},{"name":"store","description":"Access to Petstore orders"},{"name":"user","description":"Operations about user","externalDocs":{"description":"Find out more about our store","url":"http://swagger.io"}}],"schemes":["https","http"],"paths":{"/pet/{petId}/uploadImage":{"post":{"tags":["pet"],"summary":"uploads
@vhchung
vhchung / sql.ts
Created November 22, 2018 08:52
Mock class for browser development and testing SQLite on Ionic app
import { SQLiteDatabaseConfig } from '@ionic-native/sqlite';
//SQL file is loaded via script tag in index.html --> <script src="assets/sql/sql.js"></script>
declare var SQL;
export class SQLiteObject{
_objectInstance: any;
constructor(_objectInstance: any){
this._objectInstance = _objectInstance;
@vhchung
vhchung / put-object-on-aws-s3.php
Last active September 14, 2018 07:32 — forked from keithweaver/put-object-on-aws-s3.php
Upload an image/object to an AWS S3 Bucket using PHP
<?php
// Installed the need packages with Composer by running:
// $ composer require aws/aws-sdk-php
require 'vendor/autoload.php';
$bucketName = 'YOUR_BUCKET_NAME';
$filePath = './YOUR_FILE_NAME.png';
$keyName = basename($filePath);
$IAM_KEY = 'YOUR_SECRET_ACCESS_KEY';
@vhchung
vhchung / getLongLngFromMapUrl.php
Created January 24, 2018 07:28
get Long, Lng from google map url
<?php
$mapLink = 'https://www.google.com/maps/place/T%C3%B2a+Nh%C3%A0+S%C3%B4ng+%C4%90%C3%A0/@21.017695,105.7791101,17z/data=!3m1!4b1!4m5!3m4!1s0x313454ab30540137:0x35ac90387f094f93!8m2!3d21.01769!4d105.7813041';
preg_match('/@(\-?[0-9]+\.[0-9]+),(\-?[0-9]+\.[0-9]+)/', $mapLink, $latLngArray);
var_dump($latLngArray);
$lat = $latLngArray[1];
$lng = $latLngArray[2];
@vhchung
vhchung / truyencv_downloader.js
Created October 24, 2017 10:30
truyencv download userscript
// ==UserScript==
// @name TruyenCV downloader
// @namespace http://devs.forumvi.com/
// @description Tải truyện từ truyencv.com định dạng epub
// @version 2.2.1
// @icon http://i.imgur.com/o5cmtkU.png
// @author Zzbaivong
// @license MIT
// @match http://truyencv.com/*/
// @require https://code.jquery.com/jquery-3.2.1.min.js
@vhchung
vhchung / mysqldump_xml_data_structure.sh
Created December 1, 2016 04:39
mysqldump_xml_data_structure
/usr/lib/mysql-workbench/mysqldump --set-gtid-purged=OFF --user=root --host=localhost --protocol=tcp --port=3306 --default-character-set=utf8 --no-data --skip-triggers --xml -p "sample" > /home/vhchung/dumps/sample_data_structure.xml
<?php
function calculateRate($nper, $pmt, $pv, $fv, $type, $guess) {
//FROM MS http://office.microsoft.com/en-us/excel-help/rate-HP005209232.aspx
$FINANCIAL_MAX_ITERATIONS = 20;//Bet accuracy with 128
$FINANCIAL_PRECISION = 0.0000001;//1.0e-8
$y, $y0, $y1, $x0, $x1 = 0, $f = 0, $i = 0;
$rate = $guess;
if (abs($rate) < $FINANCIAL_PRECISION) {
#Odoo installation guide (on CentOS 7)
chungvh@resolve.com.vn
----------
##Operating system