Skip to content

Instantly share code, notes, and snippets.

View pdbartsch's full-sized avatar

Paul Bartsch pdbartsch

  • UC Santa Barbara
  • 93455
View GitHub Profile
@Bilka2
Bilka2 / webhook.py
Last active June 3, 2024 10:10
Simple discord webhook with python
import requests # dependency
url = "<your url>" # webhook url, from here: https://i.imgur.com/f9XnAew.png
# for all params, see https://discordapp.com/developers/docs/resources/webhook#execute-webhook
data = {
"content" : "message content",
"username" : "custom username"
}
@timmyreilly
timmyreilly / ConnectingToAzureSQLFromPython
Created October 13, 2017 23:02
Using Flask_SQLAlchemy to connect to Azure SQL
#!/usr/bin/env python
import os
import urllib.parse
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# Configure Database URI:
params = urllib.parse.quote_plus("DRIVER={SQL Server};SERVER=sqlhost.database.windows.net;DATABASE=pythonSQL;UID=username@sqldb;PWD=password56789")
@mrkrndvs
mrkrndvs / export-named-sheet-as-csv.gs
Last active July 3, 2024 06:54 — forked from mderazon/export-to-csv.gs
Google apps script to export an individual sheet as csv file
/*
* script to export data of the named sheet as an individual csv files
* sheet downloaded to Google Drive and then downloaded as a CSV file
* file named according to the name of the sheet
* original author: Michael Derazon (https://gist.github.com/mderazon/9655893)
*/
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var csvMenuEntries = [{name: "Download Primary Time File", functionName: "saveAsCSV"}];
@jnsprnw
jnsprnw / OpenRefineAdvancedCross.md
Last active August 21, 2017 18:32
Cross-reference values in OpenRefine based on multiple criteria

Cross-reference values in OpenRefine based on multiple columns

Let’s say you have these two tables:

SourceTable

name type age height
Kant Cat 2 50
Hegel Cat 2 10
Descartes Cat 5 30
Marx Dog 2 50
@gboeing
gboeing / miniconda.md
Last active January 4, 2024 01:47
Set up geospatial scientific Python with Miniconda on Windows

Set up geospatial scientific Python with Miniconda on Windows

Anaconda is an excellent, simple way to get Python up and running on your computer. But, it includes a lot of packages you'll never use but consume gigs and gigs of hard drive space. Instead, you can just install miniconda and then choose the individual packages you need. The steps below explain how to do this to set up a Python environment for geospatial data science. These steps are Windows-specific, but the same process works on Mac or Linux (just don't download the wheels from Gohlke - conda/pip install them directly). If you're having trouble, here are more detailed instructions on getting geopandas and geospatial Python up and running.

Install Miniconda

  • Download the Miniconda for Python 3.5 installer
  • Install miniconda to C:\Anaconda and set it as the system's default Python
# 10_basic.py
# 15_make_soup.py
# 20_search.py
# 25_navigation.py
# 30_edit.py
# 40_encoding.py
# 50_parse_only_part.py
@aaizemberg
aaizemberg / anotador.md
Last active May 13, 2021 17:51
Geocoding OpenRefine (using Google, OSM or USIG)
@RobbieClarken
RobbieClarken / SettingUpRaspberryPi.md
Last active January 5, 2019 14:13
Instructions for setting up a Raspberry Pi

Installing OS to SD card

  1. Download Raspbian.
  2. Install to SD card: Linux / Mac

Remove Junk

sudo apt-get remove --purge wolfram-* minecraft-pi scratch penguinspuzzle nano
sudo apt-get autoremove
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@talllguy
talllguy / ogr2ogr-dir.sh
Last active August 29, 2015 14:10
simple windows command line to convert shape files in a directory to geojson
for /R %f in (*.shp) do ogr2ogr -f "GeoJSON" "%~dpnf.geojson" "%f" -t_srs EPSG:4326