Skip to content

Instantly share code, notes, and snippets.

View markschwarz's full-sized avatar

Mark Schwarz markschwarz

  • Square Root
  • Austin, TX, USA
View GitHub Profile
@markschwarz
markschwarz / save_all_versions_in_prefix_to_folder_preserve_modified_time.py
Last active August 31, 2018 20:23
S3 Versioning - Get all versions for S3 file, saved with correct OS modified timestaps
import boto3
s3 = boto3.resource('s3')
import os
file_root = '<your_root_pathname_here>'
bucket = s3.Bucket('<your_bucket_name_here>')
prefix = '<your_prefix_aka_folder_name_here'
last_version = None
for version in bucket.object_versions.filter(Prefix=prefix):
filename = version.key + '_' + version.id
@markschwarz
markschwarz / pg_copy.sh
Created September 23, 2016 03:30 — forked from mkw/pg_copy.sh
Script to copy part or all of PostgreSQL databases between different connections
#!/usr/bin/env bash
# MIT License
#
# Copyright (c) 2016 Michael K. Werle
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/*drop table tempschwarz_raw.test_unicode_chars;
select ' ! " # $ % & '' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ …
¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó
Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ Ā ā Ă ă Ą ą Ć
ć Ĉ ĉ Ċ ċ Č č Ď ď Đ đ Ē ē Ĕ ĕ Ė ė Ę ę Ě ě Ĝ ĝ Ğ ğ Ġ ġ Ģ ģ Ĥ ĥ Ħ ħ Ĩ ĩ Ī ī Ĭ ĭ Į į İ ı IJ ij Ĵ ĵ Ķ ķ ĸ Ĺ
ĺ Ļ ļ Ľ ľ Ŀ ŀ Ł ł Ń ń Ņ ņ Ň ň ʼn Ŋ ŋ Ō ō Ŏ ŏ Ő ő Œ œ Ŕ ŕ Ŗ ŗ Ř ř Ś ś Ŝ ŝ Ş ş Š š Ţ ţ Ť ť Ŧ ŧ Ũ ũ Ū ū Ŭ
ŭ Ů ů Ű ű Ų ų Ŵ ŵ Ŷ ŷ Ÿ Ź ź Ż ż Ž ž ſ ƀ Ɓ Ƃ ƃ Ƅ ƅ Ɔ Ƈ ƈ Ɖ Ɗ Ƌ ƌ ƍ Ǝ Ə Ɛ Ƒ ƒ Ɠ Ɣ ƕ Ɩ Ɨ Ƙ ƙ ƚ ƛ Ɯ Ɲ ƞ Ɵ
Ơ ơ Ƣ ƣ Ƥ ƥ Ʀ Ƨ ƨ Ʃ' as first_1000_printable_unicode_chars
, chr(338) character_338
@markschwarz
markschwarz / Word and Character Count.scpt
Last active November 6, 2018 22:23
Word and Character Count service for Mac OS X
-- Word and Character Count service for Mac OS X
-- Adds a Word and Character Count option to the text selection context menu
-- Use Automator to create a new service, then select the Run AppleScript action. Make
-- sure the service is set to receive "text", at the top of the window. Paste in this code
-- and save as "Word and Character Count". Now switch to a new app, select some text,
-- right-click, go to Services, and find the new option.
-- Copyright 2015, Noah Slater <nslater@apache.org>