Skip to content

Instantly share code, notes, and snippets.

View eccstartup's full-sized avatar
🈲
I may be slow to respond.

Yi Lu eccstartup

🈲
I may be slow to respond.
View GitHub Profile
@eccstartup
eccstartup / RSS.py
Created December 16, 2012 12:49 — forked from mnot/RSS.py
#!/usr/bin/env python
"""
RSS.py
Classes for working with RSS channels as arbitrary data structures.
Requires Python 2.2 or newer and PyXML 0.7.1 or newer.
ChannelBase - Base class for RSS Channels.
CollectionChannel - RSS Channel modeled as a URI-per-entry

Scientific Python From Source

This document will walk you through compiling your own scientific python distribution from source, without sudo, on a linux machine. The core numpy and scipy libraries will be linked against Intel MKL for maximum performance.

This procedure has been tested with Rocks Cluster Linux 6.0 (Mamba) and CentOS 6.3.

Compiling Python From Source

#!/bin/sh
echo "Cleaning up..."
rm 00-index.tar.gz
mkdir -p package
echo "Downloading index..."
wget http://hackage.haskell.org/packages/archive/00-index.tar.gz
for splitpk in `tar tf 00-index.tar.gz | cut -d/ -f 2,3`; do
pk=`echo $splitpk | sed 's|/|-|'`
name=$pk.tar.gz
Fibonacci sequence
> fibonacciList = 1:1:zipWith (+) (tail fibonacciList) fibonacciList
Prime number sequence
> primeList = 2 : let oddList = [3,5..] in filter (\n-> and $ map (\x-> rem n x /= 0) $ takeWhile (\x -> x <= floor (fromIntegral n**(0.5))) primeList) oddList
Binomial coefficients for each order, called Pascal's Triangle
> pascalTriangleList = let fetch2 = (\(m,list) -> let ls = 1:map (\n->sum $ (take 2.drop n) list) [0..floor $ fromIntegral (m-1)/2] in ls ++ (if odd m then drop 1 else id) (reverse ls)) in [1]:[1,1]: (map fetch2 $ zip [1..] $ tail pascalTriangleList)
#!/bin/bash
echo "Cleaning up..."
#rm 00-index.tar.gz
mkdir -p package
echo "Downloading index..."
wget -c http://hackage.haskell.org/packages/archive/00-index.tar.gz
for splitpk in `tar tf 00-index.tar.gz | cut -d/ -f 1,2`; do
pk=`echo $splitpk | sed 's|/|-|'`
name=$pk.tar.gz

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Sun, 16 Dec 2012 07:15:00 GMT till Mon, 16 Dec 2013 07:15:00 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 228)
import sys
import re
class mysql_to_mssql_converter:
"""
Python script for converting MySQL dump into MSSQL compatible scripts
Based on my project, I know the following points need to be converted
1. ` need to be removed
2. ENGINE=InnoDB etc need to be removed
3. int(size), (size) is not supported for int, need to be removed.
4. AUTO_INCREMENT need to be changed to IDENTITY(1,1)

Oops! I accidentally deleted a local git branch, and I haven't pushed it to a remote server yet. The branch has several important commits, and it hasn't been merged with any other branches yet. How do I find the missing branch?

1. Create a list of all dangling or unreachable commits.

$ git fsck --full --no-reflogs --unreachable --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
unreachable tree f080522d06b9853a2f18eeeb898724da4af7aed9

Open Computing Language (OpenCL) is a language and framework for writing computationally intensive kernels that run accross heterogenious platforms, including GPUs, CPUs, and perhaps other more esoteric devices.

Intel provides an OpenCL implementation for Intel CPUs, but there's not a lot of instructions on how to get it set up. Here's what I did.

Installing Intel CPU OpenCL on Ubuntu (12.04)

  1. Download the Intel® SDK for OpenCL* Applications XE 2013 from the Intel website, here http://software.intel.com/en-us/vcsource/tools/opencl-sdk-xe. The download is a tarball -- the one I got is called intel_sdk_for_ocl_applications_2013_xe_sdk_3.0.67279_x64.tgz
  2. Unpack the tarball and cd into the new directory