- 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
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
#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
#!/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
#!/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 | |
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
#define _XOPEN_SOURCE 600 | |
#include <unistd.h> | |
#include <fcntl.h> | |
int main(int argc, char *argv[]) { | |
int fd; | |
fd = open(argv[1], O_RDONLY); | |
fdatasync(fd); | |
posix_fadvise(fd, 0,0,POSIX_FADV_DONTNEED); | |
close(fd); | |
return 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
SELECT | |
b.ts, | |
b.ost_name, | |
b.bytes_written - a.bytes_written, | |
b.bytes_read - a.bytes_read | |
FROM | |
( | |
SELECT | |
OST_DATA.TS_ID AS tsid, | |
TIMESTAMP_INFO.`TIMESTAMP` AS ts, |
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
################################################################################ | |
# | |
# Run the IOR benchmark with the POSIX I/O API and one file per task | |
# | |
################################################################################ | |
IOR START | |
### You MUST change the following parameters (see README.APEX) | |
numTasks=32 # number of MPI processes to use. You may choose to use one or more MPI processes per node. | |
segmentCount=81920 # must be > fileSize / ( blockSize * numTasks ) where fileSize must be greater than 1.5 times the aggregate DRAM available for use by |
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
### bashrc/bash_profile for SunOS 5.10 | |
# Solaris 10 lacks support for xterm-color (although it is provided in OpenCSW) | |
if [ "$TERM" == "xterm-color" ]; then | |
export TERM=xterm | |
fi | |
alias ssh='ssh -X' | |
alias ls='ls -p' | |
alias md5='digest -a md5 -v' |