Skip to content

Instantly share code, notes, and snippets.

@Quar
Quar / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Quar
Quar / seaborn_pairplot_legend_fix.py
Last active November 23, 2016 02:16
seaborn.pairplot can have its legend crushing on the right edge of the subplots on macOS. This shows a temporary solution.
import seaborn as sns
sns.set()
# turn on interactive mode, avoid-blocking
sns.plt.ion()
# take iris scatterplot matrix as an example
iris = sns.load_dataset("iris")
@Quar
Quar / logging_yaml_config.py
Last active March 23, 2017 21:12 — forked from glenfant/logging_yaml_config.py
A example of logging medium complex configuration using YAML on Python 3.6.0
# -*- coding: utf-8
"""\
A simple demo of logging configuration with YAML (Python 3.6.0)
=============================================================
Requires PyYAML -> "pip3 install PyYAML"
See the recipes for configuring logging with dicts and YAML
- https://docs.python.org/3.6/howto/logging-cookbook.html
- http://stackoverflow.com/questions/10519392/python2-7-logging-configuration-with-yaml
@Quar
Quar / dockingdocker.sh
Last active March 25, 2017 02:20
lazily install Docker
#!/bin/bash
# Docker (Community Edition) Installing Script
# usage:
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/Quar/09c0fd99ec0e5bf58c74f638b3b5bda1/raw)"
# adapted from
# https://store.docker.com/editions/community/docker-ce-server-ubuntu?tab=description
# check version
<keymap version="1" name="Mac OS X WQ" parent="Mac OS X">
<action id="ActivatePythonConsoleToolWindow">
<keyboard-shortcut first-keystroke="ctrl back_quote" />
</action>
<action id="ChooseDebugConfiguration" />
<action id="ChooseRunConfiguration">
<keyboard-shortcut first-keystroke="f10" />
</action>
<action id="CloseActiveTab" />
<action id="CloseContent">
@Quar
Quar / SelfReferenceExample.scala
Last active May 9, 2017 00:05
Self Reference Example
// continued the original example from
// https://scalerablog.wordpress.com/2015/07/13/traditionally-baked-scala-cake/
import scala.util.Random
trait MyComponent {
def service: MyService
trait MyService {
@Quar
Quar / test.R
Created May 19, 2017 15:49
Test R Code to be retrieved
x = 1:10
plot(x)
@Quar
Quar / # openblas-julia - 2017-06-14_19-37-55.txt
Created June 15, 2017 01:41
openblas-julia (staticfloat/julia/openblas-julia) on macOS 10.12.5 - Homebrew build logs
Homebrew build logs for staticfloat/julia/openblas-julia on macOS 10.12.5
Build date: 2017-06-14 19:37:55
@Quar
Quar / NWJT.md
Last active September 21, 2017 18:12
Time reference to clear worries

NWJT (Nothing is Wrong, it Just takes Time)

Without a reference, suspect of something goes wrong may increase with wall time. So here is an archieve: NWJT (Nothing is Wrong, it Just takes Time).

  • brew reinstall graph-tool --with-openmp --with-python3 --without-python
    • takes 50 minutes 9 seconds to build
  • on 2.5GHz i7, 16GB 1600MHz DDR3
@Quar
Quar / stream_tar.bash
Last active October 20, 2017 22:57
common tools
# view contents inside tar.gz
curl -s https://www.x.org/releases/individual/util/util-macros-1.19.1.tar.gz | tar -tf -
# view file inside tar.gz
curl -s https://www.x.org/releases/individual/util/util-macros-1.19.1.tar.gz | tar --strip-components 1 -xOf - util-macros-1.19.1/README
# search file using glob-pattern tcsh(1)
curl -s https://www.x.org/releases/individual/util/util-macros-1.19.1.tar.gz | tar --strip-components 1 -xOf - '**/README'