Skip to content

Instantly share code, notes, and snippets.

Matt Katz mattkatz

Block or report user

Report or block mattkatz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattkatz
mattkatz / logdoc.py
Last active Aug 3, 2018
A dirty decorator for logging the docstrings of methods as they get called.
View logdoc.py
from functools import wraps
# sometimes you need to do a bunch of tracing and it is easier to just see docstrings flow by rather than write print statements.
def logdoc(func):
'''Wraps a function and logs the docstring of that function whenever it is called
Just decorate the function:
@logdoc
def foo(bar):
"""prints the bar and returns twice the bar"""
print(bar)
@mattkatz
mattkatz / gist:65bbc17dbad94c97a01a472734b65d50
Created Sep 1, 2016 — forked from shacker/gist:87908e13c9ee6655ce90
Using the Workday API with Python and the suds client library
View gist:65bbc17dbad94c97a01a472734b65d50
import sys
from suds import client
from suds.wsse import Security, UsernameToken
from suds.sax.text import Raw
from suds.sudsobject import asdict
from suds import WebFault
'''
Given a Workday Employee_ID, returns the last name of that employee.
@mattkatz
mattkatz / SalesForceBackup.py
Last active Oct 1, 2019
Simple python Script to backup a salesforce instance to csv files
View SalesForceBackup.py
from simple_salesforce import Salesforce, SalesforceMalformedRequest
from argparse import ArgumentParser
from csv import DictWriter
from datetime import date
from pathlib import Path
production_instance = 'yourinstance.salesforce.com'
parser = ArgumentParser(description="Backs up all Salesforce objects to csv files")
parser.add_argument("username", help="User to authenticate as. Should be part of an 'integration_user' profile or some profile with no ip range restriction")
View DataMasseuse.py
from pathlib import WindowsPath
import petl as etl
class DataMasseuse:
data_files = WindowsPath("s:\files\QTRLY");
new_data_files = WindowsPath("s:\files\QTRLY\cleaned")
final_file = new_data_files / "final_file.csv"
def main(self):
#let's start fresh. Delete the previous result
View keybase.md

Keybase proof

I hereby claim:

  • I am mattkatz on github.
  • I am mattkatz (https://keybase.io/mattkatz) on keybase.
  • I have a public key whose fingerprint is RETU RN T HIS. PGP. GET_ FING ERPR INT( ); }

To claim this, I am signing this object:

View gist:10763002
// by dave @ beesandbombs.tumblr.com
////////////////////////////////////
int[][] result;
float time;
void setup() {
setup_();
result = new int[width*height][3];
}
@mattkatz
mattkatz / gist:5217960
Last active Dec 15, 2015
Why does this angular route never work? Nothing gets logged by TestCtrl...
View gist:5217960
/*
url is http://localhost/~matt/wp/wp-admin/admin.php?page=wordprss.php#/feed/2
*/
function FeedListCtrl($scope, $http, $routeParams,$location,$log){
$log.log('in feedscontrol');
$log.log('location is '+ $location.path());
$log.log($routeParams);
}
View index.html
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Faceur</title>
<meta name="description" content="">
@mattkatz
mattkatz / export_opml.php
Created Jun 20, 2012
Exporting data from wordpress.
View export_opml.php
<?php
// Set the headers so the file downloads
header('Content-type: application/xml+opml');
header('Content-Disposition: attachment; filename="Wordprss-OPML-Export.xml"');
//oh PHP. Why you gotta be so difficult about escaping things?
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">";
?>
<opml version="1.0" >
<head>
@mattkatz
mattkatz / .htaccess
Created Dec 27, 2011
Slim not logging or routing
View .htaccess
#RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
#RewriteBase /
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*)$ index.php [QSA,L]
You can’t perform that action at this time.