This file contains 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
<svg class="spinner" width="65px" height="65px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg"> | |
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle> | |
</svg> |
This file contains 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/python | |
import sys, getopt | |
def main(argv): | |
login = '' | |
password = '' | |
try: | |
opts, args = getopt.getopt(argv, "l:p", ["log=", "pas="]) | |
except getopt.GetoptError: |
This file contains 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
def file_clear(self, dir): | |
retry = True | |
while retry: | |
try: | |
retry = False | |
if (os.name == "nt"): | |
try: | |
shutil.rmtree(dir) | |
except exceptions.WindowsError, e: | |
if e.winerror == 5: # No write permission |
This file contains 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
COPY triplet_original TO '/tmp/triplet_original.csv' DELIMITER E'\t' CSV HEADER; | |
COPY "STA_apps" FROM '/var/www/tmp/sta/sta_cod.txt' WITH (FORMAT csv, DELIMITER E'\t', NULL 'NULL', HEADER); |
This file contains 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
ALTER TABLE "STA_apps" ADD COLUMN "date" timestamp without time zone NOT NULL DEFAULT now(); |
This file contains 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
from os import listdir | |
from os.path import isfile, join | |
def get_file_list(self, tmp_path): | |
files = [ f for f in listdir(tmp_path) if isfile(join(tmp_path,f)) ] | |
return files |
This file contains 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
try: | |
conn_string = "host='106.109.7.91' dbname='smarttvanalyzer' user='samson' password='samson'" | |
conn = psycopg2.connect(conn_string) | |
cursor = conn.cursor() | |
cursor.execute("""SELECT * FROM "IMS" WHERE CAST(date AS DATE) = '""" + ts + "'") | |
rows = cursor.fetchall() | |
conn.commit() | |
for row in rows: | |
print(row) |
This file contains 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 * FROM "IMS" WHERE CAST(date AS DATE) = '2014-11-14' |
This file contains 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 | |
def change_code(self, file_from, file_to): | |
BLOCKSIZE = 1048576 # or some other, desired size in bytes | |
with codecs.open(file_from, "r", "utf-16") as sourceFile: | |
with codecs.open(file_to, "w", "utf-8") as targetFile: | |
while True: | |
contents = sourceFile.read(BLOCKSIZE) | |
if not contents: | |
break |
This file contains 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
def replace(self, file_from, file_to): | |
data = open(file_from, 'rb') | |
res = open(file_to, 'wb') | |
for line in data: | |
res.write(line.replace('"', '\'')) |
NewerOlder