Skip to content

Instantly share code, notes, and snippets.

View yeukhon's full-sized avatar

Yeuk Hon Wong yeukhon

  • TikTok USDS / ByteDance
  • New York, NY
  • 23:09 (UTC -04:00)
View GitHub Profile
/*
* This app depends on jquery and a remote script called "remote.js" (serve over localhost :p)
* Locally I will have main.js and require.js.
* main.js contain an entry function "init" and it depends on jquery
* and remote.js to be fully loaded.
*/
require.config({
paths: {
"jquery": "https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min",
"remote": "http://localhost:8000/scripts/remote"
app.controller('HomeController', function($scope, $timeout, $http, $location) {
/*
In order to kill a timeout, we must save the promise ($timeout
returns a promise). We first get all the groups via calling
/api/profile to build a <select>.
We immediately trigger $scope.getAsGroup() to load data to get all
the sites the user is a member of. This function invokes like this
state machine:
$scope.get = function() {
var api_url = "/api/users"
$http.get(api_url).success(function(response, status, headers, config){
$scope.users = response.data;
});
};
<table class="table">
<thead>
app.controller("HomeController", function($scope, $http, $location, $timeout) {
$scope.promise = 0;
$scope.groups = []
$scope.group_name = ""
$http.get("/api/profile").success(function(response, status, headers, config) {
if (response.success) {
for (index in response.data["groups"])
$scope.groups.push({"name": response.data["groups"][index]})
}
@yeukhon
yeukhon / skipfish.py
Created August 6, 2013 22:57
skipfish.py
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import ast
import logging
import os
import re
import subprocess
@yeukhon
yeukhon / test.py
Created August 5, 2013 16:07
run ./zap.sh -dir /tmp/zap then quit, and edit config.xml under /tmp/zap/ to change mode from standard to protect or safe then restart using the same command
from zapv2 import ZAPv2 as zap
import time
target = "http://testfire.net"
z = zap(proxies={'http': 'http://127.0.0.1:8080'})
z.urlopen(target)
time.sleep(5)
print 'start..'
def progress(obj):
while True:
usename and password
vagrant
vagrant
ifconfig probably will give you 192.168.33.50
mongo
use minion
terminal 1
benv && super restart all && super stop minion-backend && minion-backend-api runserver -d
terminal 2 (after teriminal 1 finishes the command)
fenv && super stop minion-frontend-server && minion-frontend -a 0.0.0.0 -d
@yeukhon
yeukhon / server.py
Last active December 20, 2015 13:29
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
print "hit base url"
return """\
<html><body><a href="http://localhost:1234/path1">path1</a><a href="http://localhost:1234/path2">path2</a></body></html>"""
- name: xxxxx
template: src=${item.src} dest=${item.dest}
file: path=${item.dest} owner=you group=you mode=0777
with_items:
- oh yeah baby