Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Script to enable oplog tailing in a production meteor deployment using mongodb 4.0 or later
echo "# Enabling replication, required for oplog tailing" >> /etc/mongod.conf
echo "replication:" >> /etc/mongod.conf
echo " oplogSizeMB: 100" >> /etc/mongod.conf
echo " replSetName: rs0" >> /etc/mongod.conf
systemctl restart mongod
@chfritz
chfritz / use_robot.sh
Last active January 17, 2024 19:39
Simple script to setup your machine env to use a remote ROS master
#!/bin/bash
# Simple script to setup your machine env to use a remote ROS master
# example usage: use_robot.sh myrobot
# where myrobot is a resolvable hostname or an IP address
NORMAL=`tput sgr0 2> /dev/null`
GREEN=`tput setaf 2 2> /dev/null`
# get the IP of our device we'll use to conect to the host
@chfritz
chfritz / meteor_add_cordova.sh
Last active July 19, 2016 15:22
Make it easy to add cordova plugins to meteor just from knowing the github url.
#!/bin/bash
# Given a github url for a corvoda plugin, such as
#
# https://api.github.com/repos/cordova-sms/cordova-sms-plugin/
#
# this node.js script will generate the appropriate format for "meteor
# add" using the last commit for the tarball and pass it to meteor add.
# For instance, for the above:
#
@chfritz
chfritz / meteor_deps.sh
Created August 4, 2015 03:54
A script for checking the two-step package dependencies of a meteor project, i.e., the package dependencies of direct dependencies (as seen in `meteor list`).
meteor list | grep ^[a-z] | tr -s ' ' | cut -d ' ' -f1,2 | tr -d '\*\+' | tr ':' '_' \
| while read X Y; do \
cat ~/.meteor/packages/$X/$Y/web.browser.json \
| xargs -0 node -e "X = JSON.parse(process.argv[1]); \
X.uses.forEach(function(d) { \
console.log(\"$X\", \"$Y\", d.package, d.constraint); \
})"; \
done | sort
@chfritz
chfritz / seejson.sh
Created June 16, 2014 20:47
A tiny bash script that loads a given JSON file into an interactive node.js shell. Once the shell is loaded, look at the variable `json`.
#!/bin/bash
# explore a JSON file in node.js
# run: seejson.sh file.json
# then look at "json" in the opening node shell
node -e "json = require(\"./$1\"); repl = require(\"repl\").start(\"> \"); console.log(\"loaded... see json\");"
@chfritz
chfritz / simpleFileDragAndDrop.js
Last active May 29, 2019 21:29
HTML5: simple file drag&drop (without upload).
/*
(MIT License)
Copyright (c) 2012 Christian Fritz
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
@chfritz
chfritz / svnup_color
Created January 3, 2014 18:29
A small wrapper script for 'svn up' that sorts and colors the output depending on the type of the entry, e.g., yellow for untracked files, green for updated, blue for merged.
#!/bin/bash
BLACK="\033[30m"
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BLUE="\033[34m"
PINK="\033[35m"
CYAN="\033[36m"
WHITE="\033[37m"
@chfritz
chfritz / squeezing.tex
Created December 5, 2013 23:15
A tex file full of tricks for squeezing a latex document. Clearly you should avoid using these tricks. But when the deadline is near and you see no other way, you can use it to quickly change the formatting slightly to get more space. Just comment in some of the length changes or add other for the described sizes.
%% /** ---------------------------------------------------------
%% a file full of squeezing options
%% -- which you should try to avoid
%% -------------------------------------------------------------
%%
%% from:
%% http://www.eng.cam.ac.uk/help/tpl/textprocessing/squeeze.html
%% ---------------------------------------------------------- */
%% * Page Layout
%% o \columnsep: gap between columns
@chfritz
chfritz / fileDragAndDrop.js
Created June 18, 2013 17:03
If you like the file drag&drop functionality of knistr and would like to use it on your own page, you can. We are making this little piece of javascript available under the liberal MIT license. You can use it to turn any div element into a drop container, and specify a URL to upload the file to. If the server you are uploading to does something …
/*
(MIT License)
Copyright (c) 2012 Christian Fritz
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
@chfritz
chfritz / aaai_script.sh
Last active April 21, 2022 12:55
This shell script produces the latex source-package of a paper as required by AAAI, in preparation for printed proceedings.
#!/bin/bash
# ----------------------------------------------------------------------
# This shell script produces the latex source-package of a paper
# as required by AAAI, in preparation for printed proceedings.
# Copyright (C) 2009 Christian Fritz "fritz at cs dot toronto dot
# edu"
#
# I thank Jorge Baier for his contributions and Shirin Sohrabi for her
# feedback that has lead to improvements to the script. Thanks also