Skip to content

Instantly share code, notes, and snippets.

View zmwangx's full-sized avatar
🐍
Pythonista learning new technologies

Zhiming Wang zmwangx

🐍
Pythonista learning new technologies
View GitHub Profile
@zmwangx
zmwangx / LaTeX - making tables and figures the same type of float.tex
Last active August 29, 2015 13:56
LaTeX - making tables and figures the same type of float
% This code snippet in the preamble makes tables and figures the same type of float, so that they are placed in the same queue (and hence appear in the order of appearance).
\makeatletter
\let\ftype@table\ftype@figure
\makeatother
#!/usr/bin/env python3.3
# Convert LaTeX type dashes: - for hyphen, -- for en-dash, --- for
# em-dash to html: -, –, — in markdown.
#
# Usage:
# python dashify FILE_PATH
# ./dashify FILE_PATH
#
# One file allowed at a time. A backup file will be created each time
@zmwangx
zmwangx / Black hole information paradox.md
Last active August 29, 2015 13:58
Black hole information paradox possible solutions.

Question: How does information get out of the black hole?

Proposed options:

  1. It doesn't get out -- black hole doesn't evaporate fully, information is in remnants.
*Problem*: Pathological properties. Remnants of the Planck scale (where Hawking's black hole radiation calculations fail) enclose a huge amount of entropy.
  1. Information never falls through the horizon ("brick wall").
@zmwangx
zmwangx / ical.md
Created April 9, 2014 04:31
The iCalendar standard (.ics/.vcs) and validators.
@zmwangx
zmwangx / man-convert.sh
Created April 18, 2014 07:34
Convert man pages to PDF or HTML.
# convert a manpage to PDF, and open in Preview
# (in fact, man -t generates PostScript, which is converted to PDF by Preview)
function pman {
man -t "${1}" | open -f -a /Applications/Preview.app
}
# convert a manpage to HTML and open in the browser
function bman {
tmpfile="/tmp/bman.$RANDOM.html"
man "${1}" | man2html > $tmpfile
@zmwangx
zmwangx / exif-modify.sh
Created May 9, 2014 19:57
Modify Exif data (esp. date of creation) for correct chronological order in Carousel.
# Modify the `DateTimeOriginal' field for photos and the `CreateDate' field for videos, namely:
# photos
exiftool -overwrite_original -DateTimeOriginal="2014:05:09 12:57:16" $dir
# videos
exiftool -overwrite_original -CreateDate="2014:05:09 12:57:16" $dir
@zmwangx
zmwangx / erase_completed_downloads
Last active August 29, 2015 14:01
Chrome extension to erase completed items in the download history from the beginning of time, thus eliminating the downloads icon next to the address bar.
We couldn’t find that file to show.
@zmwangx
zmwangx / 20140527_port_installed
Created May 28, 2014 03:49
MacPorts: port installed output on 05/27/2014 (under which I successfully built GCC 4.9.0 on OS X 10.9.3).
The following ports are currently installed:
a52dec @0.7.4_0 (active)
bison @2.7.1_0 (active)
boehmgc @7.4.0_0 (active)
bzip2 @1.0.6_0 (active)
coreutils @8.22_0 (active)
cppunit @1.12.1_0 (active)
curl @7.37.0_0+ssl (active)
curl-ca-bundle @7.37.0_0 (active)
cwdiff @0.2.6_0 (active)
@zmwangx
zmwangx / configure_output
Created May 28, 2014 03:51
Output of configure when building GCC 4.9.0 on OS X 10.9.3 (with coreutils installed from MacPorts, see https://gist.github.com/ZhimingWang/b76e6168d88031b6f4f9).
checking build system type... x86_64-apple-darwin13.2.0
checking host system type... x86_64-apple-darwin13.2.0
checking target system type... x86_64-apple-darwin13.2.0
checking for a BSD-compatible install... /opt/local/libexec/gnubin//install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /opt/local/libexec/gnubin//sed
checking for gawk... gawk
checking for libatomic support... yes
checking for libcilkrts support... yes
@zmwangx
zmwangx / make_output
Created May 28, 2014 03:52
Output of make -j4 when building GCC 4.9.0 on OS X 10.9.3 (with coreutils installed from MacPorts, see https://gist.github.com/ZhimingWang/b76e6168d88031b6f4f9).
This file has been truncated, but you can view the full file.
[ -f stage_final ] || echo stage3 > stage_final
mkdir -p -- build-x86_64-apple-darwin13.2.0/libiberty
Configuring in build-x86_64-apple-darwin13.2.0/libiberty
Configuring stage 1 in ./gmp
Configuring stage 1 in ./libiberty
Configuring stage 1 in ./intl
configure: creating cache ../config.cache
checking whether to enable maintainer-specific portions of Makefiles... no
checking for makeinfo... makeinfo --split-size=5000000 --split-size=5000000
configure: creating cache ./config.cache