Skip to content

Instantly share code, notes, and snippets.

View ww9rivers's full-sized avatar

Wei Wang ww9rivers

  • 9Rivers.net LLC
  • Ann Arbor, MI
View GitHub Profile
@ww9rivers
ww9rivers / syntax-issue.js
Created June 29, 2016 18:26
Code to reproduce a Sequelize "incorrect syntax" issue.
#!/usr/bin/env node
// -*- mode:javascript; indent-tabs-mode:t; js-indent-level:8; -*-
'use strict'
var Sequelize = require('sequelize');
const
Wei_DEV = {
host: "<server-DNS-name>",
dialect: "mssql"
# PySNMP SMI module. Autogenerated from smidump -f python AFCOMFG-TMM-MIB
# by libsmi2pysnmp-0.1.3 at Wed Nov 23 14:19:30 2016,
# Python version sys.version_info(major=2, minor=7, micro=12, releaselevel='final', serial=0)
# Imports
( Integer, ObjectIdentifier, OctetString, ) = mibBuilder.importSymbols("ASN1", "Integer", "ObjectIdentifier", "OctetString")
( NamedValues, ) = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues")
( ConstraintsIntersection, ConstraintsUnion, SingleValueConstraint, ValueRangeConstraint, ValueSizeConstraint, ) = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsIntersection", "ConstraintsUnion", "SingleValueConstraint", "ValueRangeConstraint", "ValueSizeConstraint")
( Bits, Integer32, MibIdentifier, MibScalar, TimeTicks, enterprises, ) = mibBuilder.importSymbols("SNMPv2-SMI", "Bits", "Integer32", "MibIdentifier", "MibScalar", "TimeTicks", "enterprises")
/* Copyright (c) 2017 FIRST. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted (subject to the limitations in the disclaimer below) provided that
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
@ww9rivers
ww9rivers / tap-read.js
Last active December 10, 2019 17:48
Test for reading a text file out of a tar.gz archive (https://github.com/nodejs/node/issues/30885).
const fs = require('fs');
const readline = require('readline');
const util = require('util');
const tar = require('tar');
const zlib = require('zlib');
const test = require("tap").test;
function get_nsconf (archive, nsconf) {
return new Promise((resolve, reject) => {
@ww9rivers
ww9rivers / rest1.py
Created August 20, 2023 19:20
Simple Python3 script to start a Splunk search (the search actually fetches the results of a scheduled search that outputs to search-results.csv)
#!/usr/bin/env python3
import os
import requests
# Set up the session with our adapter
SEARCH_ENDPOINT = "https://"+os.environ['SPLUNK_HOST']+":8089/services/search/jobs"
headers = {
'Authorization': 'Bearer '+os.environ['SPLUNK_TOKEN'],
"Accept": "application/json"
}