Skip to content

Instantly share code, notes, and snippets.

@xuhdev
xuhdev / overleaf-auto-push.sh
Last active Oct 25, 2017
Auto push to overleaf
View overleaf-auto-push.sh
watchmedo shell-command \
--patterns='*.pdf' \
--ignore-directories \
--recursive \
--command 'git commit -a -m "U" && git push'
View git-gui-email.py
#!/usr/bin/python3
# https://www.topbug.net/blog/2016/12/13/send-git-patches-with-gui-email-clients/
import sys
import webbrowser
try:
from urllib.parse import quote # python 3
except:
View inputrc
$include /etc/inputrc
"\C-p":history-search-backward
"\C-n":history-search-forward
set colored-stats On
set completion-ignore-case On
set completion-prefix-display-length 3
set mark-symlinked-directories On
set show-all-if-ambiguous On
set show-all-if-unmodified On
@xuhdev
xuhdev / emacs-configure.sh
Last active Nov 14, 2017
My Emacs configure (for build)
View emacs-configure.sh
CFLAGS='-march=native -O3' ../configure --with-modules --with-xwidgets --prefix="$HOME/.local/opt/emacs/" --program-transform-name='s/^ctags$/ctags.emacs/' --with-mailutils
View grepl
#!/bin/bash
# Usage:
# grepl [OPTIONS] [GREP-OPTIONS] PATTERN FILE
help() {
cat <<EOF
Usage: grepl [OPTIONS] [GREP-OPTIONS] PATTERN FILE
Options:
@xuhdev
xuhdev / to-complement-dimacs.py
Last active Aug 6, 2016
Convert a graph in DIMACS format to its complement graph
View to-complement-dimacs.py
#!/usr/bin/python3
#
# Convert a DIMACS graph to its complement graph.
#
# Usage:
#
# to-complement.py < in-dimacs > out-dimacs
import sys
@xuhdev
xuhdev / gen-editorconfig-from-gitignore.sh
Last active Aug 3, 2016
Generate an editorconfig file from a gitignore file.
View gen-editorconfig-from-gitignore.sh
#!/bin/bash
# Generate an editorconfig file from a gitignore file. Usage:
#
# /path/to/gen-editorconfig-from-gitignore.sh < .gitignore >> .editorconfig
while read line
do
if [[ -z $line ]]
then
View homebrew-install-gnu.sh
# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
View gist:abb349c97307439bda4b
Running Sphinx test suite (with Python 3.4.2)...
.........................................................................................................................................................................................................................................................................................................................................................................................................................E...............................................................................................................................................................................................................................................................................SS.....................................SSSSS.SSSS.
======================================================================
ERROR: test_build_latex.test_latex
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/user/.local/lib/p
View _setup.py
#compdef setup.py
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for setup.py (http://docs.python.org/distutils/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
You can’t perform that action at this time.