This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
find /private/var/folders/ -name com.apple.dock.iconcache -exec trash {} \; | |
find /private/var/folders/ -name com.apple.iconservices -exec trash {} \; | |
trash /Library/Caches/com.apple.iconservices.store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Code referenced from `Stack Exchange \ | |
<https://apple.stackexchange.com/questions/4286/is-there-a-mac-os-x-terminal-version-of-the-free-command-in-linux-systems>`_. | |
**Note**: One need to use Python 3 to run this file! | |
""" | |
import re | |
import subprocess |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global credential.helper store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When copying a remote item’s URL, don’t include the login information (user:password@example.com) in the URL. | |
defaults write com.panic.Transmit CopyURLWithoutLogin 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults write com.apple.dock mineffect -string 'suck'; killall Dock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Referenced from | |
# https://stackoverflow.com/questions/49304329/how-to-show-all-elements-of-vectors-and-matrices-in-julia | |
function showall(io, x, limit = true) | |
println(io, summary(x), ":") | |
Base.print_matrix(IOContext(io, :limit => limit), x) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Created at May 2, 2018, by Qi Zhang | |
from abc import abstractmethod | |
import numpy as np | |
import scipy.optimize as optimize | |
class EOS: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For a detailed explanation, please see here: | |
# https://discourse.julialang.org/t/how-do-you-unfold-a-nested-julia-array/2243/7?u=singularitti | |
function deepflatten(arr::Vector{<: Vector}) | |
dim = [1] | |
function recursiveflatten(arr, dim) | |
if arr isa Vector{<: Vector} | |
recursiveflatten(collect(Iterators.flatten(arr)), | |
pushfirst!(dim, length(arr) / prod(dim))) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# function: remove pause frames of a beamer PDF | |
from pdfrw import PdfReader, PdfWriter | |
def run_stage(src, out): | |
i = PdfReader(src) | |
o = PdfWriter() | |
sum_i = len(i.pages) | |
num_i = i.Root.PageLabels.Nums | |
for r in range(1, len(num_i) // 2): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function crossProduct(arr1, arr2) { | |
/* | |
Here arr1, arr2 are both 1D arrays. | |
*/ | |
let u1 = arr1[0]; | |
let u2 = arr1[1]; | |
let u3 = arr1[2]; | |
let v1 = arr2[0]; | |
let v2 = arr2[1]; | |
let v3 = arr2[2]; |
OlderNewer