Skip to content

Instantly share code, notes, and snippets.

View MetroWind's full-sized avatar
🐱
Setting status…

Metro Wind MetroWind

🐱
Setting status…
View GitHub Profile
div.inline_editor_content, div.expanded_q_text, div.truncated_q_text
{
text-align: justify;
hyphens: auto;
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
line-height: 1.4;
}
@MetroWind
MetroWind / style.css
Last active March 2, 2016 16:27
Text justification with CSS
p, li
{
text-align: justify;
hyphens: auto;
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
}
import bpy
from mathutils import Vector
w = 1 # weight
Scale = 0.03
def readCoords(filename):
with open(filename, 'r') as File:
Coords = [[float(x) * Scale for x in line.split()] for line in File]
return list(map(Vector, Coords))
@MetroWind
MetroWind / star.py
Created February 17, 2015 08:17
生成十二星座性格特点的程序……
#!/usr/bin/env python3
# -*- coding: utf-8; -*-
from __future__ import print_function
import sys, os
import copy
import random
PY_LEGACY = (sys.version_info.major == 2)

Keybase proof

I hereby claim:

  • I am MetroWind on github.
  • I am metrowind (https://keybase.io/metrowind) on keybase.
  • I have a public key whose fingerprint is 53D7 9D02 1875 A1EE 25DC 8897 535C FE44 3159 73CE

To claim this, I am signing this object:

@MetroWind
MetroWind / Sudoku.py
Created November 24, 2015 03:37
A library to work with Sudokus.
import copy
class Sudoku(object):
"""The Sudoku class. Zero means blank."""
Numbers = set(range(1, 10))
def __init__(self, sudoku=None):
if sudoku:
self.Data = copy.deepcopy(sudoku.Data)
else:
@MetroWind
MetroWind / lorenz.nb
Created December 4, 2015 05:11
Mathematica code that calculate the Lorenz attractor.
Clear[Evaluate[Context[] <> "*"]];
SetDirectory[NotebookDirectory[]];
sigma = 10;
rho = 28;
beta = 8/3;
tMax = 50;
s = NDSolve[{x'[t] == sigma*(y[t] - x[t]),
y'[t] == x[t]*(rho - z[t]) - y[t], z'[t] == x[t]*y[t] - beta*z[t],
x[0] == 1, y[0] == 1, z[0] == 1}, {x, y, z}, {t, 0, tMax},
AccuracyGoal -> 20, PrecisionGoal -> 20, WorkingPrecision -> 40,
@MetroWind
MetroWind / MakeCurve.py
Created December 4, 2015 05:15
Create a curve in Blender.
import bpy
import math
import numpy
from mathutils import Vector
w = 1 # weight
Scale = 0.03
def readCoords(filename):
with open(filename, 'r') as File:
@MetroWind
MetroWind / .py
Created March 2, 2016 16:55
Iterator over a set while removing elements #python
myset = set([3,4,5,6,2])
while myset:
myset.pop()
print myset
@MetroWind
MetroWind / .py
Last active March 2, 2016 17:08
Make multiprocessing work with methods #python
# Make multiprocessing work with methods. Add this to the beginning of file.
if sys.version_info.major == 2:
import copy_reg as CReg
else:
import copyreg as CReg
import types
def _reduce_method(m):
if m.im_self is None:
return getattr, (m.im_class, m.im_func.func_name)