gcloud compute disks create dev-postgres-master --size=500GB --type=pd-standard
gcloud compute instances create viet-temp
| import boto3 | |
| import sys | |
| import decimal | |
| def main(): | |
| bucket = sys.argv[1] | |
| client = boto3.client('s3') | |
| result = client.list_objects_v2(Bucket=bucket, Delimiter='/') | |
| for o in result.get('CommonPrefixes'): |
| #!/bin/bash | |
| project=your-awesome-project-id | |
| main() { | |
| for image in $(gcloud container images list --repository=gcr.io/$project); do | |
| if [[ $image != 'NAME' ]]; then | |
| # clean up dummy tags | |
| clean_up_image $image "NOT tags:dev* AND NOT tags:staging* AND NOT tags:production* AND NOT tags:latest" 0 |
| #!/usr/bin/env groovy | |
| import net.sf.json.JSONArray; | |
| import net.sf.json.JSONObject; | |
| import hudson.model.Actionable; | |
| pipeline { | |
| agent { label 'golang' } | |
| options { | |
| ansiColor('xterm') |
| Host github.com | |
| HostName github.com | |
| User git | |
| IdentityFile ~/.ssh/viet_zm_mac | |
| Host gitlab.com | |
| HostName gitlab.com | |
| User git | |
| IdentityFile ~/.ssh/viet_zm_mac | |
| Host bitbucket.org | |
| HostName bitbucket.org |
| public static List<String> unzip(String zipFilePath) { | |
| try { | |
| File zipFile = new File(zipFilePath); | |
| try (ZipInputStream inputStream = new ZipInputStream(new FileInputStream(zipFile))) { | |
| List<String> fileList = new ArrayList<>(); | |
| ZipEntry entry = inputStream.getNextEntry(); | |
| while (entry != null) { | |
| File newFile = new File(zipFile.getParent() + File.separator + entry.getName()); | |
| new File(newFile.getParent()).mkdirs(); | |
| if (!entry.isDirectory()) { |
| use `your_schema`; | |
| drop function if exists `get_distance`; | |
| delimiter $$ | |
| use `your_schema`$$ | |
| create function `get_distance` (lat1 decimal(9,6), lng1 decimal(9,6), lat2 decimal(9,6), lng2 decimal(9,6)) returns decimal(10,3) | |
| begin | |
| declare R decimal(30,15); | |
| declare rlat1 decimal(30,15); | |
| declare rlat2 decimal(30,15); |
| //1 | |
| var jq = document.createElement('script'); | |
| jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
| document.getElementsByTagName('head')[0].appendChild(jq); | |
| //2 | |
| jQuery.noConflict(); |
| sudo dd if=/dev/zero of=/swapfile count=2048 bs=1MiB | |
| sudo chmod 600 /swapfile | |
| sudo mkswap /swapfile | |
| sudo swapon /swapfile |
| package com.github.viettd.how.to; | |
| import java.io.File; | |
| import java.io.FileInputStream; | |
| import java.io.FileOutputStream; | |
| import java.util.ArrayList; | |
| import java.util.Collections; | |
| import java.util.List; | |
| import java.util.zip.ZipEntry; | |
| import java.util.zip.ZipInputStream; |