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 ruby | |
# | |
# This script is a wrapper around pandoc that uses pandoc's | |
# builtin citeproc support to generate a markdown bibliography | |
# from bibtex. | |
# | |
# Inspired by Jacob Barney's [bib2mkd][] script. | |
# | |
# [bib2mkd]: http://jmbarney.dyndns.org/?/linux/bib2mkd/ | |
# |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
from: http://www.petercollingridge.co.uk/blog/converting-python-list-svg-path | |
Here's a short snippet of Python code that was I very pleased with. It converts a list of coordinates, such as this: | |
``` | |
[(10, 200), (12, 220), (15, 180)] | |
``` | |
Into the d attribute of an SVG path, such as 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
Today is a XML day for me. I am trying to parse a CSV file to a meaningful XML file to produce represent it on SCOM architecture. I wrote a Python code for parsing a basic SCOM CVS file to a fundamental SCOM XML file like that: | |
Python code: | |
import csv | |
csvFile = 'scom.csv' | |
xmlFile = 'scom.xml' |
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
# Name: parsx.py | |
# Type: Parser | |
# Purpose: PARSX: XSCML parser | |
import csv | |
csvFile = 'scom-example.sc' # SC input | |
xmlFile = 'scom-example.xml' # XML output | |
csvData = csv.reader(open(csvFile)) | |
xmlData = open(xmlFile, 'w') |
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
layer name | layer id | sublayers | |
---|---|---|---|
product | 1 | 2 | |
agent | 2 | 0 | |
flow | 3 | 0 | |
operations | 4 | 5 |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<scom> | |
<layer> | |
<layer_id>36</layer_id> | |
<layer_name>abc</layer_name> | |
<layer_value>7.6</layer_value> | |
</layer> | |
<layer> | |
<layer_id>40</layer_id> | |
<layer_name>def</layer_name> |
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 will convert PDB file saved by NIH XPLOR into XYZ format. | |
## Will also work on other PDB files, but does not process HETATM entries - only ATOM. Can be easily extended though. | |
## Usage: | |
## xplo2xyz.py [options] <file.pdb> [<file.xyz>] | |
## options: | |
## --version show program's version number and exit | |
## -h, --help show this help message and exit | |
## -o, --overwrite overwrite output file, if it exists | |
## -v, --verbose print info about files being processed | |
## Create file xplo2xyz.py, copy-paste into the content below and save. |
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
# code - http://rosettacode.org/wiki/Evolutionary_algorithm | |
from string import letters | |
from random import choice, random | |
target = list("METHINKS IT IS LIKE A WEASEL") | |
charset = letters + ' ' | |
parent = [choice(charset) for _ in range(len(target))] | |
minmutaterate = .09 | |
C = range(100) |
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
## Our simulated scientist will declare | |
## significance only if he/she gets | |
## 2 replications with p<0.05: | |
stringent<-FALSE | |
## Set the above to FALSE if you want to | |
## have the scientist publish a single | |
## expt. as soon as it's significant: | |
#stringent <- FALSE | |
## num of scientists to simulate: |
OlderNewer