There are two types of markup in Liquid: Output and Tag.
- Output markup (which may resolve to text) is surrounded by
{{ matched pairs of curly brackets (ie, braces) }}
- Tag markup (which cannot resolve to text) is surrounded by
import ctypes | |
PyFrame_LocalsToFast = ctypes.pythonapi.PyFrame_LocalsToFast | |
PyFrame_LocalsToFast.argtypes = [ctypes.py_object] | |
# Doing this with cython instead of ctypes would be much easier (and more | |
# robust). I just do it this way to keep the example self-contained. | |
frameobject_fields = [ | |
# PyObject_VAR_HEAD | |
("ob_refcnt", ctypes.c_int64), |
// width and height for the main svg | |
var w = 960, | |
h = 400, | |
margin = 50; | |
// main svg creation | |
var svg = d3.select("#chart") | |
.append("svg") | |
.attr("width", w - margin) | |
.attr("height", h); |
from collections import Counter | |
from bitarray import bitarray | |
HISTOGRAM_RANGE = 16 | |
CHAR_RANGE = 3 | |
def string_to_charc_codes(s): | |
return map(ord, list(s)) | |
def char_codes_to_modulo(chars_codes): |
#Set up data partition | |
sudo mkdir /data | |
sudo chmod 777 /data | |
sudo "echo /dev/xvdb /data ext4 rw,user,exec,comment=cloudconfig 0 2 >> /etc/fstab" | |
sudo mount /data | |
#Install build environment | |
sudo sed -i "s/enabled=0/enabled=1" /etc/yum.repos.d/epel.epo | |
sudo yum -y update | |
sudo yum -y upgrade |
from pprint import pprint | |
import jinja2 | |
import markdown | |
HTML_TEMPLATE = """{% macro get_html() %} | |
{{ content | markdown }} | |
{% endmacro %} | |
{% set html_content = get_html() %} | |
Title from Markdown meta-data: {{ get_title() }} |
#! /bin/bash | |
# Wrapper for "stata -b" which issues an informative error msg and appropriate | |
# (i.e., non-zero) return code | |
# The basic idea for this script (including grepping the log file to determine | |
# whether there was an error) was taken from a similar script posted by Brendan | |
# Halpin on his blog at http://teaching.sociology.ul.ie/bhalpin/wordpress/?p=122 | |
args=$# # number of args |
There are two types of markup in Liquid: Output and Tag.
{{ matched pairs of curly brackets (ie, braces) }}
from datetime import datetime | |
import csv | |
import sys | |
START_DATE = 'start_date' | |
END_DATE = 'end_date' | |
SPELL_ID = 'spell_id' | |
IMPUTED_END_DATE = 'imputed_end_date' | |
TOLERANCE = 31 # days | |
PRIMARY_KEYS = ['frame_id', 'person_id'] |
Git for Windows comes bundled with the "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.
The basic idea is that C:\Program Files\Git\mingw64\
is your /
directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git
, the mingw64
in this directory is your root. Find it by using pwd -W
).
If you go to that directory, you will find the typical linux root folder structure (bin
, etc
, lib
and so on).
If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corresponding directories. Sometimes the windows binary have funny prefixes, so
# This example requires CSVkit (https://github.com/wireservice/csvkit). A Python toolset with a lot of very cool CSV tools. | |
# IMPORTANT NOTE: make sure to use a proper csv file. I had a lot of trouble with a csv file created by a service with Dutch | |
# as locale. Changing it to US solved the problem. Some locales use comma's to seperate point numbers. A semicolon is then | |
# used. | |
# Create table example and Load file-a.csv into it | |
csvsql --db sqlite:///example.db --table example --insert file-a.csv | |
# Add an extra file to table example |