Skip to content

Instantly share code, notes, and snippets.

View hxtruong6's full-sized avatar
🏠
Working from home

Hoàng Xuân Trường hxtruong6

🏠
Working from home
  • Ho Chi Minh City
View GitHub Profile
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" ],
@l1x
l1x / partition.sql
Last active April 23, 2024 11:36
Creating PostgreSQL table partitions automatically based on the date field (type date as well) -- each day is a single partition
CREATE TABLE testing_partition(patent_id BIGINT, date DATE) WITH ( OIDS=FALSE);
CREATE OR REPLACE FUNCTION create_partition_and_insert() RETURNS trigger AS
$BODY$
DECLARE
partition_date TEXT;
partition TEXT;
BEGIN
partition_date := to_char(NEW.date,'YYYY_MM_DD');
partition := TG_TABLE_NAME || '_' || partition_date;

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@manabreak
manabreak / TestActivity.java
Created December 22, 2016 11:34
A simple example of using checkboxes in recyclerview
public class TestActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test_activity);
RecyclerView recycler = (RecyclerView) findViewById(R.id.recycler);
recycler.setLayoutManager(new LinearLayoutManager(this));
@kocisov
kocisov / next_nginx.md
Last active July 6, 2024 17:42
How to setup next.js app on nginx with letsencrypt
@DavidWells
DavidWells / serverless.yml
Created September 15, 2017 05:39
DynamoDB custom index serverless.yml example
service: service-name
provider:
name: aws
runtime: nodejs6.10
functions:
myfunc:
handler: handler.myfunc
@hoangmirs
hoangmirs / deploy-pm2.md
Last active July 3, 2024 17:52
Deploy pm2 guide

1. Preparing the server

Install git

sudo apt install git-all

Generate Server's SSH public key

ssh-keygen -t rsa -b 4096 -C "deploy"
cat ~/.ssh/id_rsa.pub
@cnu
cnu / download.go
Created December 2, 2018 19:23
Download files in Go
package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
@AFAgarap
AFAgarap / autoencoder-full.py
Last active March 27, 2022 14:56
TensorFlow 2.0 implementation for a vanilla autoencoder. Link to tutorial: https://medium.com/@abien.agarap/implementing-an-autoencoder-in-tensorflow-2-0-5e86126e9f7
"""TensorFlow 2.0 implementation of vanilla Autoencoder."""
import numpy as np
import tensorflow as tf
__author__ = "Abien Fred Agarap"
np.random.seed(1)
tf.random.set_seed(1)
batch_size = 128
epochs = 10
@RahulSDeshpande
RahulSDeshpande / SharedPrefs.kt
Last active February 17, 2022 06:55
'SharedPrefs' utility class written Kotlin, for storing and retrieving data from SharedPreference in Android.
import android.content.Context
import android.preference.PreferenceManager
import android.util.Log
import java.lang.ref.WeakReference
/**
* Created by rahuldeshpande on 02/06/19.
*/
object SharedPrefs {