Skip to content

Instantly share code, notes, and snippets.

View loveplay1983's full-sized avatar

michaelxuan loveplay1983

View GitHub Profile
@loveplay1983
loveplay1983 / python_blackjack.py
Created February 17, 2018 06:22 — forked from mjhea0/python_blackjack.py
python blackjack
import os
import random
deck = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]*4
def deal(deck):
hand = []
for i in range(2):
random.shuffle(deck)
card = deck.pop()
@loveplay1983
loveplay1983 / compare-svm-kernels.py
Created March 11, 2018 09:27 — forked from WittmannF/compare-svm-kernels.py
Visualization of SVM Kernels Linear, RBF, Poly and Sigmoid on Python (Adapted from: http://scikit-learn.org/stable/auto_examples/classification/plot_classifier_comparison.html)
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from sklearn.cross_validation import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.datasets import make_moons, make_circles, make_classification
from sklearn.svm import SVC
h = .02 # step size in the mesh
@loveplay1983
loveplay1983 / regex.md
Created April 11, 2018 12:47 — forked from vitorbritto/regex.md
Regex Cheat Sheet

Regular Expressions

Basic Syntax

  • /.../: Start and end regex delimiters
  • |: Alternation
  • (): Grouping
@loveplay1983
loveplay1983 / md
Created June 17, 2018 21:41
gist test
test
@loveplay1983
loveplay1983 / README.md
Created June 19, 2018 08:49 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@loveplay1983
loveplay1983 / aspnet-mvc.gitignore
Created August 10, 2018 01:19 — forked from indyfromoz/aspnet-mvc.gitignore
.Gitignore for ASP.NET MVC
###################
# compiled source #
###################
*.com
*.class
*.dll
*.exe
*.pdb
*.dll.config
*.cache
@loveplay1983
loveplay1983 / tips_and_tricks.md
Created August 15, 2018 12:45 — forked from omaciel/tips_and_tricks.md
A collection of Python tips and tricks

Flatten a dictionary

  In [1]: k = {'name': 'Og Maciel', 'age': 40, 'mansions': '', 'kids': 3}
  In [2]: ' '.join("--{!s}={!r}".format(key,val) for (key,val) in k.iteritems())
  "--age=40 --kids=3 --name='Og Maciel' --mansions=''"

Run Unittest TestCase from IPython

C++ Coding Standards Part 0: Automated Code Analysis

Automated analysis is the main advantage to working with a modern statically typed compiled language like C++. Code analysis tools can inform us when we have implemented an operator overload with a non-canonical form, when we should have made a method const, or when the scope of a variable can be reduced.

In short, these tools catch the most commonly agreed best practice mistakes we are making and help educate us to write better code. We will be fully utilizing these tools.

Compilers

All reasonable warning levels should be enabled. Some warning levels, such as GCC's -Weffc++ warning mode can be too noisy and will not be recommended for normal compilation.