View create_city_partition.sql
CREATE OR REPLACE FUNCTION create_city_partition(schema_name text, parent_table_name text, city_id int)
RETURNS text AS
$func$
DECLARE
partition_table_name text;
BEGIN
partition_table_name := parent_table_name || '_' || city_id::text;
EXECUTE format('
CREATE TABLE %I.%I PARTITION OF %I FOR VALUES IN (%L)
', schema_name, partition_table_name, parent_table_name, city_id);
View jsonb_remove_keys.sql
CREATE OR REPLACE FUNCTION jsonb_remove_keys(
jdata JSONB,
keys TEXT[]
)
RETURNS JSONB AS $$
DECLARE
result JSONB;
len INT;
target TEXT;
View jsonb_rename_keys.sql
CREATE OR REPLACE FUNCTION jsonb_rename_keys(
jdata JSONB,
keys TEXT[]
)
RETURNS JSONB AS $$
DECLARE
result JSONB;
len INT;
newkey TEXT;
oldkey TEXT;
View geoip.sh
TARGET=/root/geoip
wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz -O $TARGET/tmp.tar.gz
tar -xvzf GeoLite2-City.tar.gz -C $TARGET --strip-components 1
rm $TARGET/tmp.tar.gz
View parseFloat.go
package main
import (
"fmt"
"math"
"strconv"
"strings"
)
func ParseFloat(str string) (float64, error) {
View .eslintrc.yml
env:
es6: true
node: true
parserOptions:
ecmaFeatures:
experimentalObjectRestSpread: true
generators: false
objectLiteralDuplicateProperties: false
ecmaVersion: 6
sourceType: module
View .eslintrc.json
{
"rules": {
"strict": [
"error",
"never"
],
"import/no-unresolved": [
"error",
{
"commonjs": true,
View compact-eslint-airbnb.js
'use strict';
var _ = require('lodash');
var airbnb = require('eslint-config-airbnb');
var yaml = require('js-yaml');
function load(filename) {
console.log('load file ' + filename);
return require(filename);
}
View new-vbox-sku-discovery-graph.js
// Copyright 2015, EMC, Inc.
'use strict';
module.exports = {
friendlyName: 'SKU Discovery',
injectableName: 'Graph.SKU.Discovery',
options: {
defaults: {
graphOptions: {
View setupnat.sh
#!/bin/sh
# Reference link: http://www.aboutdebian.com/proxy.htm
INTIF="eth1"
EXTIF="eth0"
/sbin/depmod -a
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe ip_conntrack_ftp