Skip to content

Instantly share code, notes, and snippets.

@hieuht817
hieuht817 / Extra volume
Created May 14, 2018 02:01
Add Extra Volume to Baremetal Instance
# Command
```
openstack server create --volume 26fe5a62-04f7-46f1-94f5-981da2d59526 --flavor baremetal --block-device-mapping sdb=b81cac7d-7c9f-4dea-86b4-8b00eca94b8a --config-drive True --network 54d34349-c10d-4dda-9731-7acb8d91945b bm
```
# Reference
https://docs.openstack.org/nova/latest/user/block-device-mapping.html
https://storyboard.openstack.org/#!/story/2001824
java.lang.RuntimeException An error occured while executing doInBackground()
AsyncTask.java:304 android.os.AsyncTask$3.done
FutureTask.java:355 java.util.concurrent.FutureTask.finishCompletion
FutureTask.java:222 java.util.concurrent.FutureTask.setException
FutureTask.java:242 java.util.concurrent.FutureTask.run
AsyncTask.java:231 android.os.AsyncTask$SerialExecutor$1.run
ThreadPoolExecutor.java:1112 java.util.concurrent.ThreadPoolExecutor.runWorker
ThreadPoolExecutor.java:587 java.util.concurrent.ThreadPoolExecutor$Worker.run
Thread.java:818 java.lang.Thread.run
@hieuht817
hieuht817 / postgres cheatsheet.md
Last active February 25, 2018 06:47 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "\". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@hieuht817
hieuht817 / postgres-cheatsheet.md
Created February 25, 2018 06:11 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
import React from 'react';
import {
Text,
View,
} from 'react-native';
var moment = require('moment');
import BigHHMMSS from './BigHHMMSS'
import { timePass } from '../../util'
import styles, { THEME_COLOR } from '../../style';
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import { composeWithDevTools } from 'remote-redux-devtools';
import reducer from '../reducers';
export default function configureStore(initialState) {
const composeEnhancers = composeWithDevTools({ realtime: true });
const store = createStore(reducer, initialState, composeEnhancers(
applyMiddleware(thunk)
// [ec2-user@ip-10-0-0-58 vpworker]$ pwd
///home/ec2-user/vpworker
//[ec2-user@ip-10-0-0-58 vpworker]$ ls
//kill.sh nohup.out run.sh start.sh
// eg: start vpworker on all ec2
// to run `n` processes concurrently on each ec2, run this command `n` times.
./start.sh https://sqs.us-east-1.amazonaws.com/196677211866/video_process_low
// eg: kill vpworker on all ec2 for upgrade new version of worker
type WaitGroupWrapper struct {
sync.WaitGroup
}
func (w *WaitGroupWrapper) Wrap(cb func()) {
w.Add(1)
go func() {
cb()
w.Done()
}()
@hieuht817
hieuht817 / bash-cheatsheet.sh
Created October 4, 2016 13:50 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
myapp:10:03:59.211125 [gorp]
SELECT
id as ID, valid as Valid, created_at, updated_at, name as Name, display_name, IFNULL(COLUMN_GET(ext, "description" as char), "") as Description, user_id, IFNULL(COLUMN_GET(ext, "color" as char), "") as Color, IFNULL(COLUMN_GET(ext, "font" as char), "") as Font, IFNULL(COLUMN_GET(ext, "icon" as char), "") as Icon, IFNULL(COLUMN_GET(ext, "cover" as char), "") as Cover, IFNULL(COLUMN_GET(ext, "cover_mobile" as char), "") as CoverMobile, IFNULL(COLUMN_GET(ext, "cover_mobile" as char), "") as CoverBackground, (SELECT count(user_id) FROM studio.studio_fans as f WHERE f.studio_id=s.id) as NumberFan, (select count(id) from studio.episodes as e where e.video_id > 0 AND e.micro_series_id in (select id from studio.micro_series as m where m.studio_id=s.id)) as NumberVideo, (SELECT count(id) FROM studio.micro_series as m WHERE m.studio_id=s.id) as NumberSeries, IFNULL(COLUMN_GET(ext, "tier" as char), "") as Tier, (SELECT count(user_id) > 0 FROM studio.studio_fans as f WHERE f.studio_