This file contains hidden or 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
;; create a list | |
(list 1 2 3) | |
;; Use getf on a plist (property list) to get an item | |
(getf (list :a 1 :b 2 :c 3) :a) | |
;; create a function that takes 4 fields as arguments and returns a plist representing that CD. | |
(defun make-cd (title artist rating ripped) | |
(list :title title :artist artist :rating rating :ripped ripped)) | |
;; call that function |
This file contains hidden or 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
# creating | |
see plan: >> terraform plan | |
create resources: >> terraform apply | |
# destroying | |
see plan: >> terraform plan -destroy | |
destroy: >> terraform destroy |
This file contains hidden or 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
# ec2 | |
aws ec2 describe-instances |
This file contains hidden or 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
### Deleting branches #### | |
# delete local branch | |
git branch -d branch_name | |
# The -d option is an alias for --delete, which only deletes the branch if it has | |
# already been fully merged in its upstream branch. You could also use -D, | |
# which is an alias for --delete --force, which deletes the branch "irrespective of its merged status." | |
# delete remote branch: two commands you can use | |
git push origin --delete <branch_name> | |
git push origin :<branch_name> |
This file contains hidden or 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
""" | |
For example, if your yaml file is: | |
- mysite: | |
url: www.hello.com | |
username: blah | |
pw: blah | |
# local temp directory for storing data | |
- local_temp_dir: '/my/temp/dir/' | |
""" |
This file contains hidden or 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
# To get the first directory in a path, e.g., return "First" for path /First/Second/Third/file.txt | |
# there is no easy way to do this using the os.path utilities. Instead, use pathlib | |
# see: http://stackoverflow.com/questions/26724275/removing-the-first-folder-in-a-path | |
import pathlib2 | |
mypath='/first-dir/second-dir/third-dir' | |
p = pathlib2.Path(mypath) | |
firstdir = p[2] # first element is the '/'. If you don't have a root '/', then the first element is the first dirname | |
subdirs = p[3:] |
This file contains hidden or 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
""" | |
see: http://boto3.readthedocs.io/en/latest/reference/services/s3.html | |
set up your aws credentials in ~/.aws/credentials and default region per instructions | |
here: https://github.com/boto/boto3 | |
""" | |
s3 = boto3.resource('s3') | |
# List objects within bucket prefix paths | |
my_bucket = s3.Bucket('base-bucket-name') |
This file contains hidden or 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 bash | |
# DATA_PATH should be the path to the dir holding your input data, e.g., "/mnt/data/" | |
# THREADS should be an integer | |
DATA_PATH=$1 | |
THREADS=$2 | |
VSQL_BIN="/opt/vertica/bin/vsql" |
This file contains hidden or 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
import logging | |
import argparse | |
def testfunc(): | |
logging.info("This is a log message.") | |
if __name__ == "__main__": | |
parser.add_argument('--log', dest='loglevel', required=False, type=str, default='DEBUG', | |
help='logging level. By default is debug.') |
This file contains hidden or 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
__author__ = 'junjaytan' | |
""" | |
A simple script to detect if any files exist in a destination directory. If no files exist, then it finds | |
the oldest file from an input directory and moves it to the destination directory. | |
This functionality is useful if you want to ensure that input records get added to a directory in the | |
same order they were created | |
""" | |
import os | |
import shutil |
NewerOlder