Skip to content

Instantly share code, notes, and snippets.

# ~/.lldbinit-Xcode
# Apple private methods
command regex ivars 's/(.+)/po [%1 _ivarDescription]/'
command regex methods 's/(.+)/po [%1 _methodDescription]/'
command regex shortmethods 's/(.+)/po [%1 _shortMethodDescription]/'
command regex nextviewcontroller 's/(.+)/po [%1 _nextViewControllerInResponderChain]/'
command alias nextvc nextviewcontroller
# Convenience
@Quar
Quar / predef.sc
Created January 15, 2019 04:48
ammonite predef.sc
interp.load.ivy(
"com.lihaoyi" %
s"ammonite-shell_${scala.util.Properties.versionNumberString}" %
s"[${ammonite.Constants.version.replaceAll(raw"([\d]+\.[\d+]).*", "$1.0")},)" // use [x.x.0,) in case edge version no avail. in Maven
)
@
val shellSession = ammonite.shell.ShellSession()
import shellSession._
import ammonite.ops._
import ammonite.shell._
@Quar
Quar / build.sbt
Created October 8, 2018 06:11
spark2.3.2 assemblyMergeStrategy
assemblyMergeStrategy in assembly := {
case PathList("org","aopalliance", xs @ _*) => MergeStrategy.last
case PathList("javax", "inject", xs @ _*) => MergeStrategy.last
case PathList("javax", "servlet", xs @ _*) => MergeStrategy.last
case PathList("javax", "activation", xs @ _*) => MergeStrategy.last
case PathList("org", "apache", xs @ _*) => MergeStrategy.last
case PathList("com", "google", xs @ _*) => MergeStrategy.last
case PathList("com", "esotericsoftware", xs @ _*) => MergeStrategy.last
case PathList("com", "codahale", xs @ _*) => MergeStrategy.last
case PathList("com", "yammer", xs @ _*) => MergeStrategy.last
@Quar
Quar / README.md
Last active October 25, 2018 22:26
auto-install old version of OpenFOAM on Ubuntu-18.04

OpenFOAM Auto Install Script

Note that this script will try to auto install OpenFoam from souce (which means will download source code) and then compile on local machine. This script is primarily targated at installing old-releases of OpenFOAM which do not have binary installation packages pre-compiled on APT.

The entire installation time cost approximately 2-6 hours depends on network bandwidth and CPU memory power.

@Quar
Quar / .asoundrc
Created September 18, 2018 00:47
fix Thinkpad x120e no speaker sound on Ubuntu
# borrowed from wnelson on ubuntuforms
# https://ubuntuforums.org/showthread.php?t=1899601
pcm.!default {
type hw
card 1
}
ctl.!default {
type hw
@Quar
Quar / Makefile
Last active January 18, 2019 22:56
a very crude lazy script for dockerized SageMath on macOS
# Set Jupyter Notebook Root Directory on Host to be mounted in Docker
# such that all changes within Docker will be saved to local.
HOST_JUPYTER_NOTEBOOK_ROOT = $(PWD)/code
# if port 8888 on localhost has been used, change to another free port
CONTAINER_PORT = 8888
########################################
CONTAINER_NAME = sagemath
CONTAINER_CODE_ROOT = /home/sage/code
require 'formula'
class PkgExtract < CurlDownloadStrategy
def stage
safe_system '/usr/bin/xar', '-xf', @tarball_path
chdir
safe_system 'mv *.pkg/Payload Payload.gz'
safe_system 'ls | grep -v Payload | xargs rm -r'
end
end
adns
adwaita-icon-theme
akka
amap
ammonite-repl
ant
apache-spark
arp-scan
arpack
asciidoc
@Quar
Quar / README.md
Created June 14, 2018 01:16
Offline Install Python Package with `pip3`

Offline Install Python Package with pip3

Yes you can do it with pip3 (or pip).

And it is simple.

Now we assume you have two computers, both have python3 and pip3 installed, and:

  • hostA has internet connection
  • hostB does not have internet connection