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
SET @total=0; | |
SELECT | |
column_a, | |
column_b, | |
COUNT(*) AS cnt, | |
COUNT(*) / @total * 100 as p, | |
@total AS total | |
FROM | |
( | |
SELECT |
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. Copy histroy from source repository | |
$ git clone --mirror [source repository] | |
# 2. move dir | |
$ cd [source repository].git | |
# 3. set dest repository | |
$ git remote set-url --push origin [dest repository] | |
# 4. push to dest repository |
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
<project ....> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.inventory</groupId> | |
<artifactId>Inventory</artifactId> | |
<packaging>jar</packaging> | |
<version>0.0.1-SNAPSHOT</version> | |
<name>Inventory Management</name> | |
<dependencies> |
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
SELECT A.columnA | |
FROM TableA AS A | |
LEFT JOIN TableB AS B ON (A.columnA = B.columnA) | |
WHERE B.columnA IS NULL |
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
-- deduplicate with recent data | |
SELECT * FROM | |
( | |
SELECT ROW_NUMBER() OVER(PARTITION BY date_key,CountryName ORDER BY regdatetime DESC) AS ROWNUM, * | |
FROM temp where packageName = 'com.test' | |
) A | |
WHERE ROWNUM = 1 AND date_key > '2017-01-10' order by date_key asc | |
-- example | |
/* |
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
-- strandard SQL | |
-- normal table | |
SELECT COUNT(*) `project_id.data_set.table_name` | |
-- partition table | |
SELECT COUNT(*) `project_id.data_set.table_name` Where _PARTITIONTIME = '2017-01-02' |
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 codecs | |
with codecs.open('filename.txt', 'r', 'utf-8') as f: | |
f.read() |
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 os | |
directory = '/home/kenny/gist' | |
if not os.path.exists(directory): | |
os.makedirs(directory) | |