Skip to content

Instantly share code, notes, and snippets.

View kvutien's full-sized avatar

Vu Tien Khang kvutien

View GitHub Profile
@kvutien
kvutien / react-index.html
Last active January 2, 2021 21:12
A pure index.html generated by react-create-app
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
@kvutien
kvutien / blank-react-app;js
Last active January 2, 2021 22:09
minimum app.js for illustration
import './App.css';
import React,{Component} from 'react';
class App extends Component {
constructor(){
super();
}
render(){
@kvutien
kvutien / myfrontend.txt
Last active January 3, 2021 11:35
folder structure created by create-react-app
kvutien@MBP18VTK-2 myfrontend % tree
.
├── README.md
├── node_modules
...
├── package-lock.json
├── package.json
├── public
│   ├── favicon.ico
│   ├── index.html
@kvutien
kvutien / create-run-react.sh
Created January 3, 2021 11:25
Simple example of the commands to create and run a react application
npx create-react-app myfrontend
cd myfrontend
npm run start
@kvutien
kvutien / React-Solidity-Zubait
Created January 8, 2021 11:04
Updated solidity code for Zubair Ahmed
ppragma solidity ^0.4.11;
contract ReactExample{
address private owner;
string public youAwesome;
string private secret;
function ReactExample() public {
owner = msg.sender;
youAwesome = 'You are awesome';
@kvutien
kvutien / BestNDVIMosaic.js
Last active January 10, 2021 22:35
Generate mosaic with the best NDVI of a month over a period of time
/*
* @notice GEE JavaScript for Code Editor
* @notice Generate a mosaic using pixels of the best NDVI of all images of a month
* @notice Do it over all same months of a period of time, for example March (or August, or December)
* @notice ... useful to remove clouds and calculate monthly NDVI stats over several years
* @author Vu Tien Khang, licence MIT, Jan 2021
*/
// make a list of years composing the history
var history = ee.List.sequence(2017, 2020);
// per year of history, calculate bestNDVI and add to bestNDVICollection
@kvutien
kvutien / BestNDVIMosaic-full.js
Last active January 11, 2021 09:11
Complete GEE Code Editor app inclusing BestNDVIMosaic core
/*
* @notice fully functional GEE JavaScript for Code Editor
* @notice Generate a mosaic using pixels of the best NDVI of all images of a month
* @notice Do it over all same months of a period of time, for example March (or August, or December)
* @notice ... useful to remove clouds and calculate monthly NDVI stats over several years
* @author Vu Tien Khang, licence MIT, Jan 2021
*/
// prepare the refrence set of images, here it's Sentinel-2 MSI: MultiSpectral Instrument, Level-1C
var myPoint = ee.Geometry.Point(78.2875, 10.4156); // Sendurai, Tamil Nadu, India
Map.centerObject(myPoint, 13); // close zoom around central point, zoom scale 13
@kvutien
kvutien / orbitdb-tuto-sh.js
Created July 8, 2021 09:57
Tutorial "Hello World" for IPFS & OrbitDB
/*
* create an orbitDB key-value database of pet animals
* July 2021 - (c) Vu Tien Khang - Machu Picchu
*/
// import the packages
const IPFS = require('ipfs-http-client');
const OrbitDB = require('orbit-db');
async function main () {
const ipfsOptions = { }; // placeholder
@kvutien
kvutien / orbitdb-tuto-sh.txt
Created July 8, 2021 10:08
output of orbitdb-tuto-sh.js
[1] 28719
Initializing daemon...
go-ipfs version: 0.7.0
Repo version: 10
System version: amd64/darwin
Golang version: go1.14.4
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip4/127.0.0.1/udp/4001/quic
...
WebUI: http://127.0.0.1:5001/webui
@kvutien
kvutien / wpa_supplicant.conf
Created September 6, 2021 16:10
Raspbian wpa-supplicant example
country=LU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="your wi-fi SSID"
psk="your-wifi-password-example204877"
}