- The Python interpreter is not thread safe, so multithreading doesn't actually work (https://wiki.python.org/moin/GlobalInterpreterLock)
- Python contains features that are known to just plain not work
- round doesn't actually round numbers. (https://docs.python.org/2/library/functions.html#round) The notion of rounding a base10 number is fundamentally a base10 operation. Why the hell would you try to do it in base 2?
- os.path.commonprefix doesn't actually return valid paths (https://docs.python.org/2/library/os.path.html#os.path.commonprefix)
- Python's regex engine is obtuse and slow (http://glennklockwood.blogspot.com/2012/04/revisiting-perl-and-python-speed.html)
- MAJOR changes between MINOR revisions (2.6, 2.7)
- subprocess.check_output
- the "with" statement
- MAJOR changes between 2.0 and 3.0, like redefining fundamental math operations (https://www.python.org/dev/peps/pep-0238/)
- Time doesn't work
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 python | |
import RPi.GPIO as GPIO | |
input_pin = 14 | |
output_pins = [22, 17, 5, 6, 13, 12, 25, 24, 27, 23] | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(input_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) | |
for pin in output_pins: | |
GPIO.setup(pin, GPIO.OUT) | |
i = 0 |
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 python | |
import spi | |
### Initialize an SPI connection using BCM-mode pins 21, 20, and 16 | |
max7219 = spi.SPI(clk=21, cs=20, mosi=16, miso=None, verbose=True) | |
### Zero out all registers | |
for cmd in range(16): | |
packet = cmd << 8 |
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 python | |
"""Vary resistance on a digital potentiometer and measure the effect using | |
an analog-digital converter""" | |
import spi # from https://github.com/glennklockwood/raspberrypi | |
import time | |
### use two independent SPI buses, but daisy chaining then is also valid | |
adc = spi.SPI(clk=18, cs=25, mosi=24, miso=23, verbose=False) | |
digipot = spi.SPI(clk=19, cs=13, mosi=26, miso=None, verbose=False) |
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
#include <stdio.h> | |
#include <sched.h> | |
int main( int argc, char**argv ) | |
{ | |
#pragma omp parallel | |
{ | |
printf( "Hello world from thread %d of %d running on cpu %2d!\n", | |
omp_get_thread_num()+1, | |
omp_get_num_threads(), |
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
ubuntu@ubuntu:~$ sudo dmidecode | |
# dmidecode 3.0 | |
Getting SMBIOS data from sysfs. | |
SMBIOS 3.0.0 present. | |
Table at 0x8AF1D000. | |
Handle 0x0000, DMI type 16, 23 bytes | |
Physical Memory Array | |
Location: System Board Or Motherboard | |
Use: System Memory |
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
always @(posedge clk) | |
cnt = cnt + 1; |
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 | |
CSRF_TOK=$(curl --verbose -D - https://my.es.net/ 2>/dev/null | grep -o 'csrftoken=[^;]*' | cut -d= -f2) | |
echo "CSRF token = [$CSRF_TOK]" | |
curl \ | |
--referer https://my.es.net/nersc-400g \ | |
-X POST \ | |
-b "csrftoken=$CSRF_TOK" \ | |
-H "X-CSRFToken: $CSRF_TOK" \ |
The Cori acceptance test for both the Lustre file system (cscratch) and the burst buffer used IOR to obtain the peak numbers that were advertised.
DataWarp Phase I used 4480 processes (ppn=4) with the following IOR command-line options:
./IOR -a MPIIO -g -t 512k -b 8g -o $DW_JOB_STRIPED/IOR_file -v
./IOR -a POSIX -F -e -g -t 512k -b 8g -o $DW_JOB_STRIPED/IOR_file -v
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 | |
# | |
# Update the created/modified dates of PDF files to match the Notability .note | |
# native format's metadata. Used to preserve date ordering of notes exported | |
# from Notability. | |
# | |
# Step 1. Back up notability to a shared drive in the native "Note" format | |
# Step 2. Change the backup format to PDF and create PDF versions | |
# Step 3. Run this script against each .note file | |
# |