Skip to content

Instantly share code, notes, and snippets.

@sunapi386
sunapi386 / newgistfile1
Created October 22, 2013 21:18
What does this gist do? Nothing. Just testing and checking what this is.
Apparently, gist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versioned, forkable and usable from Git.
@sunapi386
sunapi386 / 2048botter
Last active August 29, 2015 13:57
2048 bot
// Sometimes solves kortaggio's 5x5 variant of 2048: http://kortaggio.github.io/2048/
// Open the javascript console with F12 and copy past this in.
// export the game manager into the global namespace
GameManager.prototype.__original_actuate = GameManager.prototype.actuate;
GameManager.prototype.actuate = function() {
window.gm = this;
this.__original_actuate();
GameManager.prototype.actuate = GameManager.prototype.__original_actuate;
};
@sunapi386
sunapi386 / mutt
Created March 14, 2014 00:27
marc burns mutt send config
# sending
# SMTP use the univ serv
set smtp_url="smtp://j53sun@mailservices.uwaterloo.ca:587"
set ssl_starttls=yes
set ssl_force_tls=yes
@sunapi386
sunapi386 / gist:8f395711409c9fde93c7
Created June 24, 2014 02:59
Make Rooms in Claims
r = session.query(ClaimRoom)[-1]
for name in range(0,10):
ClaimAsset(room=r,product_type_name=name,simple=False)
session.commit()
@sunapi386
sunapi386 / guacaadduser.md
Created October 20, 2015 01:46
Guacamole Add User

Adding a user

Create a user

Then create the user; remember setting to his password to "chessman123"

sudo adduser binsun

Modifying guacamole's user login data

@sunapi386
sunapi386 / generics.swift
Created January 13, 2016 22:21
Swift gists
// Generic Types
class Carousel<T: CustomStringConvertible> {
var items = [T]()
var currentPosition = 0
var count: Int {return items.count}
var isEmpty: Bool {return items.isEmpty}
func append(item: T) {items.append(item)}
func next() -> T? {
if self.isEmpty { return nil }
Output the symmetric difference of two sorted streams of numbers.
Examples:
list1 = [1,3,5,8]
list2 = [2,5,6,7,8]
output = [1,2,3,6,7]
input1 = [1,2,3,4,99,100]
input2 = [3,4,5,6,99]
output = [1, 2, 5, 6, 100]
@sunapi386
sunapi386 / qq_fetcher.js
Created March 19, 2016 07:05
Fetches blog from qqzone
// http://user.qzone.qq.com/765591203
var pages = document.getElementById("tblog").contentWindow.document.getElementsByClassName("mod_pagenav_count")[0];
var posts = document.getElementById("tblog").contentWindow.document.getElementById("listArea").getElementsByTagName("li");
for (var i = 0; i < 1 /*posts.length*/; i++) {
var postTitle = posts[i].getElementsByClassName("article")[0].textContent;
var postLink = posts[i].getElementsByClassName("article")[0].getElementsByTagName("a")[0].href
// http://user.qzone.qq.com/765591203/blog/1400775512
var entryDate = posts[i].getElementsByClassName("list_op")[0].childNodes[0].textContent;
var readCount = posts[i].getElementsByClassName("list_op")[0].childNodes[2].textContent;
<!DOCTYPE html>
<meta charset="utf-8" />
<title>WebSocket Test</title>
<script language="javascript" type="text/javascript">
function submit()
{
wsUri = document.getElementById("wsUriInput").value;
testWebSocket();
// #bodyContent > div.mw-content-ltr > table:nth-child(21) > tbody > tr:nth-child(500)
//*[@id="bodyContent"]/div[4]/table[10]/tbody/tr[500]
// bgcolor="33CC33"
c=document.getElementById("bodyContent")
d=c.getElementsByClassName("mw-content-ltr")[0]
e=d.getElementsByTagName("table")
phoneTable=e[e.length - 4]
phoneBuilds = []