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 / settings.txt
Last active December 30, 2015 05:09
settings
[("GCC extra via C opts", " -fwrapv"),
("C compiler command", "/usr/bin/gcc"),
("C compiler flags", " -m64 -fno-stack-protector -m64"),
("ar command", "/usr/bin/ar"),
("ar flags", "clqs"),
("ar supports at file", "@ArSupportsAtFile@"),
("touch command", "touch"),
("dllwrap command", "/bin/false"),
("windres command", "/bin/false"),
("perl command", "/usr/bin/perl"),
#!/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
@eccstartup
eccstartup / squid.conf
Created December 16, 2013 13:37
squid 3.1.19 configuration
# WELCOME TO SQUID 3.1.19
# ----------------------------
#
# This is the documentation for the Squid configuration file.
# This documentation can also be found online at:
# http://www.squid-cache.org/Doc/config/
#
# You may wish to look at the Squid home page and wiki for the
# FAQ and other documentation:
# http://www.squid-cache.org/

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) -> user.followers > 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)
@eccstartup
eccstartup / IHaskell console.txt
Created January 10, 2014 14:49
IHaskell console
$ IHaskell console
Installing dependency: pyzmq-14.0.1
Downloading/unpacking pyzmq==14.0.1
Saved /var/folders/3r/5c02fv4j15l0khx6qllnx4dc0000gn/T/tmpThreadId118949/pyzmq-14.0.1.tar.gz
Running setup.py egg_info for package pyzmq
no previously-included directories found matching 'docs/build'
no previously-included directories found matching 'docs/gh-pages'
warning: no directories found matching 'bundled/uuid'
warning: no previously-included files found matching 'bundled/uuid/Makefile*'

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

#Haskell基础

  • 语法、语义
  • 常用函数实现
  • 函数参考
  • 语法拾遗
  • Codeforces
  • 99 Problem
  • Euler
  • Queue
import Data.List
-- 第一行照写,第二行开头加空格反写;如果不够一行,前面加空格填充
arrange :: Int -> String -> [String]
arrange n str
| n == 1 = [str]
| length str <= n = [str]
| length str <= (2*n-1) = [take n str,replicate (2*n-1 - length str) ' ' ++ reverse (drop n str) ++ " "]
| otherwise = arrange n (take (2*n-1) str) ++ arrange n (drop (2*n-1) str)