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
@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)
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 / 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;
}
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;
}
#include <stdio.h>
int main()
{
#ifdef __GNUC__
printf("I'm gcc. yay~~\n");
#else
printf("I'm not gcc. Yay~~\n");
#endif
@MetroWind
MetroWind / color-test.html
Created May 20, 2013 10:12
Test browser representation of colors
<!DOCTYPE html>
<html>
<head>
</head>
<body style="background-color: #ff4e0c">
</body>
</html>
@MetroWind
MetroWind / common.css
Last active December 17, 2015 01:29
A custom CSS for Wikipedia.
div#content h1#firstHeading
{
font-family: ScalaOT, Scala, Mate, Palatino, STZhongsong, "Songti SC", serif;
font-variant:small-caps;
margin-top: 1.5em;
}
div#bodyContent
{
width: 520pt;
@MetroWind
MetroWind / prefetch.cpp
Last active December 16, 2015 22:19
Prefetch test...
#include <iostream>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
typedef int Type;
struct Measurement
{
double Value;
@MetroWind
MetroWind / mkramdisk.py
Created December 6, 2012 22:18
Quickly create a ramdisk in Mac
#!/usr/bin/env python3
# Usage: $0 SIZE
#
# SIZE can be string like "512k", "1G"...
SectorSize = 512 # Bytes
SIZE_UNITS = {'b': 1.0, 'c': 1.0, 'w': 2.0, 'k': 1024.0,
'M': 1024.0 * 1024.0, 'G': 1024.0 ** 3.0,
'T': 1024.0 ** 4.0, 'P': 1024.0 ** 5.0,
}
#!/usr/bin/env python3
import sys, os
import zlib
ChunkSize = 1024*1024
def crcFile(f):
Chunk = f.read(ChunkSize)
CRC = 0