Skip to content

Instantly share code, notes, and snippets.

View tianweiliu's full-sized avatar

Tianwei Liu tianweiliu

View GitHub Profile
@tianweiliu
tianweiliu / firebaseStorage.js
Last active July 11, 2018 01:07
angular factory for angular firebase upload
.factory('$firebaseStorage', ['$q', function($q) {
var $firebaseStorage = {
_ref: firebase.storage().ref(),
upload: function(_path, _file, _onProgress) {
return $q(function(resolve, reject) {
if (!_path) {
reject(new Error('no path'));
}
else if (!_file) {
reject(new Error('no file'));
@tianweiliu
tianweiliu / cinder.man
Created September 21, 2015 16:13
Generic Windows Instrumentation Manifest for Cinder
<?xml version="1.0" encoding="UTF-16"?>
<instrumentationManifest xsi:schemaLocation="http://schemas.microsoft.com/win/2004/08/events eventman.xsd" xmlns="http://schemas.microsoft.com/win/2004/08/events" xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:trace="http://schemas.microsoft.com/win/2004/08/events/trace">
<instrumentation>
<events>
<provider name="myCinderApp" guid="{3CC9AD90-4C2C-4775-8B4A-4EB012C76E1A}" symbol="myCinderApp" resourceFileName="C:\myCinderApp.exe" messageFileName="C:\myCinderApp.exe">
<events>
<event symbol="verbose" value="100" version="0" channel="Application" level="win:Informational" template="cinder" keywords="cinder " message="$(string.target-iot.event.100.message)">
</event>
<event symbol="info" value="101" version="0" channel="Application" level="win:Informational" template="cinder" keywords="cinder " message="$(string.target-iot.
@tianweiliu
tianweiliu / cinder.conf
Last active September 16, 2015 15:31
nxlog configuration for cinder file log in Windows
## This is a sample configuration file. See the nxlog reference manual about the
## configuration options. It should be installed locally and is also available
## online at http://nxlog.org/nxlog-docs/en/nxlog-reference-manual.html
## Please set the ROOT to the folder your nxlog was installed into,
## otherwise it will not start.
#define ROOT C:\Program Files\nxlog
define ROOT C:\Program Files (x86)\nxlog
@tianweiliu
tianweiliu / pysyslog.py
Last active October 26, 2021 15:08 — forked from marcelom/pysyslog.py
Tiny Python Syslog Server
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'yourlogfile.log'
import sys
from ouimeaux.environment import Environment
from scapy.all import *
def on_switch(switch):
print "WeMo Switch found:", switch.name
print "Status:", "off" if switch.get_state() == 0 else "on"
def arp_display(pkt):