Here's a few things I tried to write output to a python subprocess pipe.
from subprocess import Popen, PIPE
p = Popen('less', stdin=PIPE)
for x in xrange(100):
p.communicate('Line number %d.\n' % x)
CREATE EXTENSION tablefunc; | |
CREATE TABLE sales(year int, month int, qty int); | |
INSERT INTO sales VALUES(2007, 1, 1000); | |
INSERT INTO sales VALUES(2007, 2, 1500); | |
INSERT INTO sales VALUES(2007, 7, 500); | |
INSERT INTO sales VALUES(2007, 11, 1500); | |
INSERT INTO sales VALUES(2007, 12, 2000); | |
INSERT INTO sales VALUES(2008, 1, 1000); | |
INSERT INTO sales VALUES(2009, 5, 2500); |
Here's a few things I tried to write output to a python subprocess pipe.
from subprocess import Popen, PIPE
p = Popen('less', stdin=PIPE)
for x in xrange(100):
p.communicate('Line number %d.\n' % x)
# Needed PS packages | |
# Install-Package -Name pscx | |
# Install-Package -Name AWSPowerShell | |
# | |
# Scheduling | |
# The script then needs to be scheduled to run every night, I’m using scheduled tasks for this, | |
# creating a task that runs nightly and triggers the powershell script by running | |
# Powershell.exe with the arguments | |
# -ExecutionPolicy Bypass C:\SqlBackup\SqlBackupToS3.ps1. | |
# From <https://www.rhysgodfrey.co.uk/b/blog/posts/backing-up-a-sql-database-to-amazon-s3-using-powershell> |
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Net.Http; | |
using System.Net; | |
namespace HTTP_Test |
def download_file(url): | |
local_filename = url.split('/')[-1] | |
# NOTE the stream=True parameter | |
r = requests.get(url, stream=True) | |
with open(local_filename, 'wb') as f: | |
for chunk in r.iter_content(chunk_size=1024): | |
if chunk: # filter out keep-alive new chunks | |
f.write(chunk) | |
#f.flush() commented by recommendation from J.F.Sebastian | |
return local_filename |
#!/usr/bin/env python | |
from type_checked_entities import entity_factory | |
Giraffe = entity_factory( # let's define what is a giraffe! | |
"giraffe", | |
name=str, # my name is a string | |
age=float, # my age is an int | |
eats=object, # I eat pretty much everything. | |
) |
def detectDelimiter(csvFile): | |
with open(csvFile, 'r') as myCsvfile: | |
header=myCsvfile.readline() | |
if header.find(";")!=-1: | |
return ";" | |
if header.find(",")!=-1: | |
return "," | |
#default delimiter (MS Office export) | |
return ";" |
<div class="table-title"> | |
<table class="table-fill"> | |
<thead> | |
<tr> | |
{% for col in table[0] %} | |
<th>{{ col }}</th> | |
{% endfor %} | |
</tr> | |
</thead> | |
<tbody> |
public void WriteClickLinks(DataTable dt, string filepath) | |
{ | |
StreamWriter output = new StreamWriter(filepath); | |
StringBuilder sb = new StringBuilder(); | |
using (output) | |
{ | |
foreach (DataColumn col in dt.Columns) | |
{ |