Skip to content

Instantly share code, notes, and snippets.

@zdway10
zdway10 / pi_generator.py
Created March 17, 2020 22:54 — forked from xiaolai/pi_generator.py
calculate pi using python generator.
#!/usr/bin/env python
def pi():
# Wallis' product
numerator = 2.0
denominator = 1.0
while True:
yield numerator/denominator
if numerator < denominator:
numerator += 2
@zdway10
zdway10 / futures_pi.py
Created March 17, 2020 22:54 — forked from xiaolai/futures_pi.py
Calculating PI with Python
import functools
import random
import math
from concurrent import futures
def map_d(c):
return math.hypot(random.random(), random.random())
{
"cmd": ["make", "clean"],
"cmd": ["make", "html"],
"working_dir": "${project_path:${folder}}",
"selector": "text.restructuredtext"
}
@zdway10
zdway10 / gist:bd4a1c844bcdcdfd98d9cd2ecbafe062
Created March 17, 2020 22:55 — forked from xiaolai/gist:447d8961954dfd28047a797e4f82addd
SublimeText: Tab to move cursor out of parentheses, quotes, brackets
// Original by C0D312
// I added the single quote and curly brace to the regex.
// http://www.sublimetext.com/forum/viewtopic.php?f=3&t=5174
//
// Add the following to your user keybindings:
[
{ "keys": ["tab"], "command": "move", "args": {"by": "characters", "forward": true}, "context":
[
{ "key": "following_text", "operator": "regex_contains", "operand": "^[)}'\"\\]]", "match_all": true },
@zdway10
zdway10 / markdownhere.css
Created March 17, 2020 22:55 — forked from xiaolai/markdownhere.css
markdown-here-css
.markdown-here-wrapper {
font-size: 16px;
line-height: 1.8em;
letter-spacing: 0.1em;
}
pre, code {
font-size: 14px;
font-family: Roboto, 'Courier New', Consolas, Inconsolata, Courier, monospace;
@zdway10
zdway10 / markdown-here-css.css
Created March 17, 2020 22:55 — forked from xiaolai/markdown-here-css.css
chrome extension css
.markdown-here-wrapper {
font-family: STheiti, 'Open Sans';
padding: 1em;
}
hr {
border: 3px dotted #009688;
}
em, i, a {
@zdway10
zdway10 / nvmrc
Created March 17, 2020 22:56 — forked from xiaolai/nvmrc
bash function for load .nvmrc automatically
# for nvm
export NVM_DIR="$HOME/.nvm"
. "$(brew --prefix nvm)/nvm.sh"
load-nvmrc() {
if [[ -f .nvmrc && -r .nvmrc ]]; then
nvm use
elif [[ $(nvm version) != $(nvm version default) ]]; then
echo "Reverting to nvm default version"
nvm use default
@zdway10
zdway10 / gist:0fab4181e65048674c4cc3975b5560fe
Created March 17, 2020 22:57 — forked from xiaolai/gist:3783233
disable dashboard of os x
defaults write com.apple.dashboard mcx-disabled -boolean YES
kill all dock
@zdway10
zdway10 / sublime_user_settings.js
Created March 17, 2020 22:57 — forked from xiaolai/sublime_user_settings.js
Example user settings for sublime text 2
{
"color_scheme": "Packages/User/textmate-solarized/Solarized (Dark).tmTheme",
// "color_scheme": "Packages/User/textmate-solarized/Solarized (Light).tmTheme",
// "color_scheme": "Packages/User/TextMate-Tomorrow-Theme/Tomorrow-Night-Eighties.tmTheme",
// "color_scheme": "Packages/User/TextMate-Tomorrow-Theme/Tomorrow-Night-Bright.tmTheme",
// "color_scheme": "Packages/User/TextMate-Tomorrow-Theme/Tomorrow-Night.tmTheme",
"font_size": 12,
"font_face": "menlo",
// "font_face": "monaco",
// "font_face": "Inconsolata",
@zdway10
zdway10 / nokogiri libxml homebrew lion
Created March 17, 2020 22:58 — forked from xiaolai/nokogiri libxml homebrew lion
How to fix: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
FIXME:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
or
libxml_ruby.bundle: dlsym(0x10fde1900, Init_libxml_ruby): symbol not found
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2