Skip to content

Instantly share code, notes, and snippets.

View bryan-lunt's full-sized avatar

Bryan Lunt bryan-lunt

  • Department of Computer Science, UC San Diego
  • Urbana, Illinois
View GitHub Profile
@voldien
voldien / CMakeLists.txt
Last active April 29, 2025 17:23
Using CMake for creating latex build target.
PROJECT(LatexProject NONE)
CMAKE_MINIMUM_REQUIRED(VERSION 3.11)
FIND_PACKAGE(LATEX)
IF(LATEX_FOUND)
IF(LUALATEX__FOUND)
MESSAGE(STATUS "lualatex found - ${LUALATEX_COMPILER}")
ENDIF()
IF(BIBTEX_FOUND)
MESSAGE(STATUS "bibtex found - ${BIBTEX_COMPILER}")
@sbliven
sbliven / timeout_fn.sh
Last active September 21, 2020 15:50
'timeout' command, implemented within the shell so that it works with shell functions
#!/bin/zsh
# A version of the 'timeout' command that works with shell functions
#
# Usage:
# source timeout_fn.sh
# timeout_fn DURATION COMMAND [ARG]...
timeout_fn () {
local timeout=$1
shift
@iridiumcao
iridiumcao / check_git_branch_exists.sh
Created March 22, 2020 13:57
How to check if a git branch exists in the local/remote repository?
# Local:
# https://stackoverflow.com/questions/21151178/shell-script-to-check-if-specified-git-branch-exists
# test if the branch is in the local repository.
# return 1 if the branch exists in the local, or 0 if not.
function is_in_local() {
local branch=${1}
local existed_in_local=$(git branch --list ${branch})
if [[ -z ${existed_in_local} ]]; then
echo 0
@bmatcuk
bmatcuk / create-usb.sh
Created May 30, 2019 04:38
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
@basnijholt
basnijholt / slurm_ipyparallel.md
Last active July 5, 2023 12:24
Using Slurm with ipyparallel

Using ipyparallel on the cluster

One time only

Create a parallel profile

ipython profile create --parallel --profile=slurm

cd into ~/.ipython/profile_slurm/

@thiagowfx
thiagowfx / FindBoost.cmake
Last active January 4, 2025 21:55
FindBoost.cmake (Note: DO NOT DELETE as it's linked from Stack Overflow)
# - Find Boost
#
# Copyright (c) 2016 Thiago Perrotta
#
# 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, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
@mdavezac
mdavezac / MPI_benchmark_example
Last active January 23, 2025 02:02
google/benchmark example with MPI
# for gist naming purposes
# according to http://jdfreder-notebook.readthedocs.org/en/docs/examples/Notebook/Importing%20Notebooks.html
import io, os, sys, types
from IPython import get_ipython
from IPython.nbformat import current
from IPython.core.interactiveshell import InteractiveShell
def find_notebook(fullname, path=None):
"""find a notebook, given its fully qualified name and an optional path
This turns "foo.bar" into "foo/bar.ipynb"
@LeoHuckvale
LeoHuckvale / gist:89683dc242f871c8e69b
Created February 2, 2015 16:53
matplotlib - Add subplots dynamically
@pbugnion
pbugnion / ipython_notebook_in_git.md
Last active October 22, 2023 12:25
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.