Skip to content

Instantly share code, notes, and snippets.

View stevenhao's full-sized avatar

Steven Hao stevenhao

View GitHub Profile
#monitor-white,#monitor-black {
overflow: scroll;
overflow-y: scroll;
overflow-x: scroll;
white-space: nowrap;
width: 400px;
float:left;
position:relative;
left:-200px;
}
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
const int MAXN = 4010;
const int MAXK = 100;
const int inf = 1000 << 20;
int ar[MAXN];
// ==UserScript==
// @name Generals.io
// @namespace http://tampermonkey.net/
// @version 0.1
// @description toolbox for generals.io
// @author Steven Hao
// @match http://generals.io/*
// @grant none
// ==/UserScript==
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Problem 1 LTI Properties (26 pts)

[24 pts] Classify the following systems, with input $x(t)$ (or $x[n]$) and output $y(t)$ (or $y[n]$). In each column, write "yes", "no", or "?" if the property is not edcidable with the given information. (+1 for correct, 0 for blank, -0.5 for incorrect). (For 1d, you are given the system is known to be linear and time=invariant.) For 1b and 1d, 2 test input cases are given.

Let $\Pi(t) = u(t + \frac12) - u(t - \frac12)$.

System Causal Linear Time-invariant BIBO stable
a. $y(t) = 2x(t-1)-5$ yes no yes yes
b. \begin{cases} x & \text{if input }x(t)=0 \ tu(t) & \text{if input }x(t)=u(t-1)\end{cases} ? ? ? no
c. $y(t) = x(t)[\cos(2\pi t)u(t)]$ yes yes no yes
@stevenhao
stevenhao / git-diff.diff
Last active June 27, 2017 00:21
Breaking Blaze HTML-escaping of <script> contents
diff --git a/packages/boilerplate-generator/boilerplate-generator.js b/packages/boilerplate-generator/boilerplate-generator.js
index 22e06e98f..9be1cc14c 100644
--- a/packages/boilerplate-generator/boilerplate-generator.js
+++ b/packages/boilerplate-generator/boilerplate-generator.js
@@ -88,6 +88,7 @@ Boilerplate.prototype._generateBoilerplateFromManifestAndSource =
readUtf8FileSync(pathMapper(item.path));
}
});
+ boilerplateBaseData.test = 'alert("Is one less that two? Click to find out!"); if (1 < 2) alert("YES!") else alert("NO!")';
var boilerplateRenderCode = SpacebarsCompiler.compile(
function printDBInfo() {
print('');
print('====================================================================');
print('DB Version: ' + db.version());
print('Storage Engine: ' + JSON.stringify(db.serverStatus().storageEngine));
print('Replication Info: ' + JSON.stringify(db.getReplicationInfo()));
print('');
}
printDBInfo();
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 0.0.0.0
replication:
replSetName: rs0
@stevenhao
stevenhao / distribution_sort.py
Created November 30, 2017 02:27
WIP Distribution sort
# 6.851 Coding Problem: Distribution Sort
""" Prompt:
Implement external-memory distribution sort and/or cache-oblivious distribution sort, possibly with a simpler pivot rule (e.g. random).
How do they compare to quicksort?
"""
class Array: