Skip to content

Instantly share code, notes, and snippets.

View siteslave's full-sized avatar

Satit Rianpit siteslave

View GitHub Profile
@siteslave
siteslave / version-check.dart
Created October 25, 2019 17:42 — forked from naumanahmed19/version-check.dart
Flutter Force Update IOS and Android App Version
//Prompt users to update app if there is a new version available
//Uses url_launcher package
import 'package:url_launcher/url_launcher.dart';
const APP_STORE_URL =
'https://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftwareUpdate?id=YOUR-APP-ID&mt=8';
const PLAY_STORE_URL =
'https://play.google.com/store/apps/details?id=YOUR-APP-ID';
@siteslave
siteslave / go-ssh-reverse-tunnel.go
Created June 29, 2019 17:11 — forked from codref/go-ssh-reverse-tunnel.go
Go SSH reverse tunnel implementation (SSH -R)
/*
Go-Language implementation of an SSH Reverse Tunnel, the equivalent of below SSH command:
ssh -R 8080:127.0.0.1:8080 [email protected]
which opens a tunnel between the two endpoints and permit to exchange information on this direction:
server:8080 -----> client:8080
@siteslave
siteslave / mysql-docker.sh
Created June 13, 2019 15:43 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@siteslave
siteslave / backends.js
Created June 10, 2019 14:48 — forked from kevinswiber/backends.js
Express Gateway Example with Multiple Services
const express = require('express');
const forum = express();
forum
.get('/healthz', (req, res, next) => {
res.send({ name: 'forum', status: 'healthy' });
next();
})
.get('/d/:id', (req, res, next) => {
@siteslave
siteslave / instructions.md
Created May 6, 2019 07:09 — forked from alextanhongpin/instructions.md
Setting up locale on alpine:3.6 docker image

Locale

When using the alpine docker image, the command locale -a or locale-gen does not exist. You might need them to install different locales in your docker image to allow your applications to support multilingual. Most common issue is when dealing with database inputs (MySQL), whereby the text will be displayed as garbage characters if you do not have the right locale installed.

FROM alpine:3.6

# ---not shown here---
@siteslave
siteslave / base64-encode-decode.js
Created December 19, 2018 16:26 — forked from sid24rane/base64-encode-decode.js
Node.js Base64 Encode Decode -> Image
var buffer = require('buffer');
var path = require('path');
var fs = require('fs');
function encode_base64(filename){
fs.readFile(path.join(__dirname,'/public/',filename),function(error,data){
if(error){
throw error;
}else{
var buf = Buffer.from(data);
@siteslave
siteslave / ionic_publish_android_app.md
Created October 28, 2015 03:15 — forked from leommoore/ionic_publish_android_app.md
Ionic Publish Android App

#Ionic Publish Android App

This is the process to publish an ionic android app.

  1. Make sure you set/increment the version number in config.xml ie 0.0.3.

  2. Make sure the android platform has been added

Angular Material Table

md-table custom element Attributes : -headers : Array of objects which include "name" and "field" keys for table columns. -content : Array of object which is the content of table rows. -sortable : StringArray with name of sortable columns. -filters : String which filters rows in table (here a ng-model is used). -customClass : Object with columns names as keys and class names as values. -thumb : String equals to the thumbs column name.