This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo dd if=/dev/zero of=/swapfile count=2048 bs=1MiB | |
| sudo chmod 600 /swapfile | |
| sudo mkswap /swapfile | |
| sudo swapon /swapfile |
NewerOlder