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
""" | |
This script illustrates how to use sys.argv to | |
capture command-line arguments. | |
Dowload & run this file like so: | |
python example.py | |
OR like this: |
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 | |
""" | |
Test if we can reliably figure out the uncompressed size of .gz file... | |
""" | |
import gzip | |
import os | |
import subprocess | |
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 | |
""" | |
process some data | |
""" | |
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor | |
from joblib import Parallel, delayed | |
import os | |
import statistics |
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
""" | |
See Streaming API: https://twython.readthedocs.io/en/latest/usage/streaming_api.html | |
""" | |
import os | |
import sys | |
from twython import TwythonStreamer | |
class TweetPrinter(TwythonStreamer): | |
def on_success(self, data): |
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
/** | |
* | |
* Experiment: Trying to see how an output file could possibly be corrupted | |
* by failed program.... | |
* | |
* | |
* e.g. https://trello.com/c/7F9VWd2s/980-error-in-vincsv-from-the-logger | |
* | |
* Experiment: | |
* |
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
import json | |
import requests # 3rd-party lib, "pip install reqeusts" to install. | |
from pprint import pprint | |
def get_stuff(payload="hello"): | |
""" | |
This function will talk to httpbin.org, via a GET request. It will send | |
the provided payload, and print out the http status code and the arguments | |
it receives from httpbin. |
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
class Animal: | |
# This is our base class that describes an Animal. | |
sound = "..." # The default sound an animal makes. | |
def __init__(self, sound=None): | |
# This is a constructor method. It will | |
# set up an animal's sound. | |
if sound: | |
self.sound = sound |
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
/* Pointers! | |
* | |
* Address of and value at... | |
* | |
* See this great stack overflow answer for an additional | |
* discussion on the topic. | |
* | |
* https://stackoverflow.com/a/2094715/182778 | |
* | |
*/ |
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
Copyright 2020 Brad Montgomery | |
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 copies of the Software, and to permit persons to whom the Software is furnished to do so, | |
subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial | |
portions of the Software. |
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
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int i; | |
for(i=0; i < 10000000; i++) { | |
*&i = 10; |