This is good for security so you can make a template file for security keys or whatever without commiting your own keys by accident.
First, set the file up how you want it to look in the repo:
touch <file>
subl3 <file>
# -*- coding: utf-8 -*- | |
""" | |
========= | |
tikzmagic | |
========= | |
Magics for generating figures with TikZ. | |
.. note:: |
<?xml version="1.0"?> | |
<root> | |
<appdef> | |
<appname>MACVIM</appname> | |
<equal>org.vim.MacVim</equal> | |
</appdef> | |
<appdef> | |
<appname>CHROME</appname> | |
<equal>com.google.Chrome</equal> | |
</appdef> |
#!/bin/bash | |
# requires fswatch | |
fswatch -o . -e "\\.git.*"| xargs -n1 -I{} git commit -am "snapshot from autocommit_script.sh" |
% place in preamble: | |
%\usetikzlibrary{trees} | |
%\usetikzlibrary{decorations.text} | |
\begin{figure}[htb] | |
\centering | |
\ffigbox[\FBwidth]{\caption{Alliance Decisions in An incomplete information framework} | |
\label{}}{ | |
\begin{tikzpicture} |
#!/usr/bin/env ruby | |
require 'date' | |
dates=Array.new() | |
#end date is 'c' | |
c = Date.new(2015,05,07) | |
# start date is 'b' | |
b= Date.new(2015,01,12) | |
days_of_week=["Monday","Wednesday","Friday"] | |
max_weeks= ((c-b)/7).to_int | |
max_weeks=max_weeks.ceil+1 |
tr -cd '\11\12\15\40-\176' < file-with-binary-chars > clean-file | |
# from http://alvinalexander.com/blog/post/linux-unix/how-remove-non-printable-ascii-characters-file-unix |
You have a project
with a submodule
and a nested submodule
. it took me a while to figure out how to convert it to subtrees.
The basic reason is to convert is to make it so that deployment and installation by others is easier and doesn't create as many problems when branching.
The basic process to do this (there are others that involve splitting, but i found this to be easier). in a repo named with a :
(?# Find:) | |
^\ *\\begin\{\w+?\}.*%[ |\t]+class="(\w+?)".*?\n | |
(?# Replace:) | |
\\begin{\1}\n | |
(?# Find:) | |
^\ *\\end\{\w+?\}.*%[ |\t]+class="(\w+?)".*?\n |
Occassionally we want to make a rule that matches on something more complex than file extensions. If, for example files that will be prefixed with pandoc_ depend on files that do not contain the prefix.
Ex: pandoc_slides=>slides.rmd. we can make a rule that will capture this, but we need to use a lambda function to do so:
rule (%r{pandoc_.*\.md}) => lambda{|objfile| potential_source_files.find{objfile.pathmap("%{pandoc_,}n")}} do |t|
puts "This rule gets #{t.name} from #{t.source}"
end