Skip to content

Instantly share code, notes, and snippets.

View yeungon's full-sized avatar
💭
In JavaScript we trust

Vuong Nguyen yeungon

💭
In JavaScript we trust
View GitHub Profile
@yeungon
yeungon / vultr-snapshot.md
Created December 6, 2017 10:08
Automatic snapshots using Vultr API

Automated Snapshots / Backups via Vultr API

A more customizable alternative to Vultr's backup feature using Vultr API v1. Tested on Ubuntu 16.04. Run this php script on a Vultr instance to create a snapshot of itself and rotate out the oldest snapshot(s). Use the $backup_tag field to uniquely id a set of snapshots.

  1. Set $api_key to your Vultr API key.
  2. Set $num_of_backups to specify how many snapshots to keep.
  3. Set chmod +x vultr-snapshot.php.
  4. Add vultr-snapshot.php to your cron tab.
  5. Epic winning at life.
@yeungon
yeungon / API.php
Created December 6, 2017 12:55
api.php
<?php
class restful_api {
/**
* Property: $method
* Method được gọi, GET POST PUT hoặc DELETE
*/
protected $method = '';
/**
* Property: $endpoint
* Endpoint của api
@yeungon
yeungon / Remove $key in json using PHP
Created December 25, 2017 10:10
Remove $key in json using PHP
<?php
$file = file_get_contents('http://localhost/search/oxfordupdate.json');
$data = json_decode($file, TRUE);
// unset($file);//prevent memory leaks for large json.
//insert data here
@yeungon
yeungon / .htaccess
Created January 9, 2018 02:08 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@yeungon
yeungon / README.md
Created January 30, 2018 14:27 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


@yeungon
yeungon / gist:2c5fdc8cca9e2d6a583543ca6ec1fd7a
Created February 10, 2018 06:11
a simply PHP query log_currently used at tudien.net
<?
/*
* @author: Vuong Nguyen [email protected]
* fopen() => mở
* fget() => đọc S, C,
* fread() => đọc hết file theo dung lượng, lấy dung lượng theo filesize()
* fwrite() => viết ==> thuộc tính W: ghi đè, A: ghi kế tiếp, nếu xuống dòng *\r\n
* fclose() => đóng
*/
@yeungon
yeungon / are you are philosopher?
Created April 7, 2018 16:03
are you are philosopher?
<?php
//are you a philosopher? by vuongnguyen
class trietgia{
public $world_level_school_of_thought_what_is_the_world = 'ontology';
public $world_level_school_of_thought_how_we_know_the_world_as_it_is = 'epistemology';
function __construct($name){
<?php
function highLight($a, $b){
$a = explode(" ", $a);
$count = count($a);
$number = count($b);
<?php
$tong = 8;
for($i = 0; $i < $tong; $i++){
for($j = 0; $j < $i; $j++){
echo " ";
@yeungon
yeungon / Ubuntu For Developer
Last active November 25, 2018 14:04
Ubuntu from the scratch (for Vietnamese)
We couldn’t find that file to show.