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
module Lab3 where
-----------------------------------------------------------------------------------------------------------------------------
-- LIST COMPREHENSIONS
------------------------------------------------------------------------------------------------------------------------------
-- ===================================
-- Ex. 0 - 2
-- ===================================

#Haskell基础

  • 语法、语义
  • 常用函数实现
  • 函数参考
  • 语法拾遗
  • Codeforces
  • 99 Problem
  • Euler
  • Queue
@eccstartup
eccstartup / introrx.md
Last active August 29, 2015 14:08 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@eccstartup
eccstartup / lab2.hs
Created October 31, 2014 09:32
lab2 of FP101x
module Lab2 where
------------------------------------------------------------------------------------------------------------------------------
-- Lab 2: Validating Credit Card Numbers
------------------------------------------------------------------------------------------------------------------------------
import Data.Char
-- ===================================
-- Ex. 0
-- ===================================
#!/bin/bash
export here=`pwd`
cd /Applications/MATLAB_R2014a.app/bin
./matlab -nodesktop -r 'cd $here'
unset here

Why You Can't Un-Root a Compromised Machine

Let's say somebody temporarily got root access to your system, whether because you "temporarily" gave them sudo rights, they guessed your password, or any other way. Even if you can disable their original method of accessing root, there's an infinite number of dirty tricks they can use to easily get it back in the future.

While the obvious tricks are easy to spot, like adding an entry to /root/.ssh/authorized_keys, or creating a new user, potentially via running malware, or via a cron job. I recently came across a rather subtle one that doesn't require changing any code, but instead exploits a standard feature of Linux user permissions system called setuid to subtly allow them to execute a root shell from any user account from the system (including www-data, which you might not even know if compromised).

If the "setuid bit" (or flag, or permission mode) is set for executable, the operating system will run not as the cur

import Data.List
beadsort :: [Int] -> [Int]
beadsort = tail $ map (length. concat) $ inits $ group $ map sum $ transpose $ map (\n -> replicate n 1)

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@eccstartup
eccstartup / reverse.js
Created June 27, 2014 13:04
js function to reverse a string
var reverse = function(str){
if (str.length==0){
return str;
}
else{
return reverse(str.substring(1))+str[0];
}
}

As compiled by Kevin Wright a.k.a @thecoda

(executive producer of the movie, and I didn't even know it... clever huh?)

please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!

This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!

Monday June 16th