First, learn JSON. It's not programming language, not even close. Just follow syntax rules and you will be fine.
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
function Math(el) | |
if el.mathtype == "InlineMath" then | |
if el.text:sub(1,1) == '`' and el.text:sub(#el.text) == '`' then | |
local text = el.text:sub(2,#el.text-1) | |
return pandoc.Math(el.mathtype, text) | |
else | |
local cont = pandoc.read(el.text) | |
return { pandoc.Str("$") } .. cont.blocks[1].content .. { pandoc.Str("$") } | |
end | |
end |
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 dask.dataframe as dd | |
from dask.dataframe.utils import make_meta | |
from dask.delayed import delayed | |
import pandas as pd | |
from itertools import chain | |
def get_stata_dask_meta(file_name, meta_chunksize=10000, *args, **kwargs): | |
"""Load up first bit of the file for type metadata info. We have to resort |
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
# Ref: https://www.svds.com/jupyter-notebook-best-practices-for-data-science/ | |
# Jupyter 4.x is now out! | |
# Further, config files are stored in ~/.jupyter by default. This directory is the JUPYTER_CONFIG_DIR environment variable. I’m going to first describe the above with the default config, and go into the complicated way of doing with Jupyter’s version of profiles. | |
# The default config file is found at: ~/.jupyter/jupyter_notebook_config.py | |
# If you don’t have this file, run: jupyter notebook --generate-config to create this file. |
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
#!/bin/bash | |
# remove exited containers: | |
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v | |
# remove unused images: | |
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi | |
# remove unused volumes: | |
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <( |
Here is a list of scopes to use in Sublime Text 2/3 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
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
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby | |
# SET YOUR_HOME TO THE ABSOLUTE PATH OF YOUR HOME DIRECTORY | |
# chmod +x install.rb | |
# ./install.rb | |
YOUR_HOME = '' | |
HOMEBREW_PREFIX = "#{YOUR_HOME}/usr/local" | |
HOMEBREW_CACHE = '/Library/Caches/Homebrew' | |
HOMEBREW_REPO = 'https://github.com/Homebrew/homebrew' |
This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.
A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:
- It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
- It is free, with no quotas.
- Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
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
#Option 1 - install openblas with homebrew and link to CRAN installed R | |
brew tap homebrew/science | |
brew install openblas | |
ln -sf /usr/local/Cellar/openblas/0.2.12/lib/libopenblas.dylib /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib | |
#Option 2 - install r with openblas through homebrew | |
brew tap homebrew/science | |
brew install r --with-openblas |
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
# Kevin Gilbert | |
# CMU CS '14 | |
# Formulas in R are hard to manipulate, and cannot have string functions applied to them. This fixes that. | |
# ---------- ---------- ---------- ---------- ---------- | |
# given two formulas, merge their predictors |
NewerOlder