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/python3 | |
import fileinput | |
from datetime import datetime, date, timedelta | |
from collections import OrderedDict | |
from argparse import ArgumentParser | |
parser = ArgumentParser() | |
parser.add_argument("-s", "--step", default='minutes', help="group by seconds, minutes or hours") | |
parser.add_argument('files', metavar='FILE', nargs='*', help='files to read, if empty, stdin is used') |
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
#!/bin/bash | |
rootdir="/usr/local/bin/checks" | |
checkfile=${1//[^a-zA-Z0-9_]/} | |
checkfile="${rootdir}/$checkfile" | |
checkname=${1//[^a-zA-Z0-9_]/} | |
if [ $# -lt 2 ]; then | |
echo "Usage:" | |
script=`basename "$0"` | |
echo "${script} <check_script> <check_name> [arg1] [arg2] [argN]" | |
exit 1 |
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 project.code AS project_id, | |
subproject.code AS subproject_id, | |
project.recordtype, | |
project.atype AS type, | |
lwrregion.NAME AS region, | |
lwrregion2.NAME AS region2, | |
Getprojectcountries(project.id) AS countries, | |
country2.NAME AS country, | |
COALESCE(agriculture, 0) AS agriculture, | |
agriculture_count, |
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/env python | |
# -*- coding: utf-8 -*- | |
import codecs | |
import sys | |
from simple_salesforce import Salesforce | |
import secrets | |
UTF8Writer = codecs.getwriter('utf8') | |
sys.stdout = UTF8Writer(sys.stdout) |
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 | |
# -*- coding: utf-8 -*- | |
import pandas as pd | |
commcare_data = pd.read_excel("commcare.xlsx", header=0) | |
lac_data = pd.read_excel("lac.xlsx", sheet_name="BENEFICIARIO", header=1) | |
for index, commcare_row in commcare_data.iterrows(): | |
if commcare_row["form.dui"] in lac_data[u"Número de Identificación"]: | |
print commcare_row["form.dui"] | |
lac_row = pd.DataFrame({ | |
u"Nombre de Proyecto":["SOS"], |
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 csv | |
import copy | |
import random | |
def play(datum, min=1, max=25): | |
if datum == '': | |
return 0 | |
else: |
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
#!/bin/bash | |
DEST=/backup1/example/mail/spool/ | |
TEST=/backup1/BACKUP.txt | |
if [ ! -f $TEST ]; then | |
echo "Backup disk not mounted!" | |
exit | |
fi |
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
projects = sf.query_all("SELECT Id, Name, Project_Identifier__c, Project_Type__c, LWR_Region__c, Start_Date__c, End_Date__c FROM Project__c WHERE RecordTypeId <> '0120Z0000016F8q' AND End_Date__c >= 2017-09-30") | |
i = 1 | |
objs = ['Agriculture__c', 'Climate_Change__c', 'Constituent_Engagement__c', 'Emergency_Operations__c', 'Civic_Participation__c', 'Health_Livelihood__c', 'Water__c', 'Other__c'] | |
objs_string = ",".join(objs) | |
print "Number,Id,Project_Identifier__c,Project_Type__c,LWR_Region__c,Start_Date__c,End_Date__c,Name,%s" % (objs_string) | |
for item in projects['records']: | |
subs = sf.query_all("SELECT Id, %s FROM Sub_Project__c WHERE Project__r.Id='%s'" % (objs_string, item['Id'])) | |
data = {} | |
for o in objs: |
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/env python | |
from simple_salesforce import Salesforce | |
import pprint | |
pp = pprint.PrettyPrinter(depth=6) | |
token = 'token' | |
username = '[email protected]' | |
password = 'password' |
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/env python | |
import datetime | |
import os | |
from datadog import initialize, api | |
from collections import defaultdict | |
options = { |
NewerOlder