Skip to content

Instantly share code, notes, and snippets.

View bunlongheng's full-sized avatar

Bunlong Heng bunlongheng

View GitHub Profile
# --------------------------------------------------------------
# Goal : Remove file base on input match
# Run : curl | python3
import os
import sys
rootdir = os.path.abspath(os.curdir)
View loopThroughAnObject.js
console.log("Environment variables----------------")
let variables = pm.environment.toObject();
console.log(typeof (variables)) //object
Object.keys(variables).forEach(function(key) {
console.log(key, variables[key]);
View sendEmail. applescript.applescript
set recipientName to "Zuse"set recipientAddress to ""set theSubject to "Subject" -- leave empty set theContent to ""tell application "Mail" ##Create the message set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true} ##Set a recipient tell theMessage make new to recipient with properties {name:recipientName, address:recipientAddress} ##Send the Message send end tellend tell
View angularjs.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf 8">
<body ng-app="app">
<h1 ng-controller="HelloWorldCtrl">{{message}}</h1>
<script src=""></script>
<script src="app.js"></script>
View es_input.cfg
<?xml version="1.0"?>
<inputConfig type="joystick" deviceName="GPIO Controller 1" deviceGUID="15000000010000000100000000010000">
<input name="a" type="button" id="1" value="1" />
<input name="b" type="button" id="0" value="1" />
<input name="hotkey" type="button" id="6" value="1" />
<input name="pagedown" type="button" id="5" value="1" />
<input name="pageup" type="button" id="4" value="1" />
<input name="select" type="button" id="6" value="1" />
<input name="start" type="button" id="7" value="1" />
View controller.fortinet.js
const FortinetService = require("../services").Fortinet;
module.exports = (config, jwtDecode) => {
let fortinet = {};
* Login
* @return {object} response
fortinet.login = async (req, res, next) => {
View policy-factory
const Account = require('../services').Account;
const FortinetService = require("../services").Fortinet;
const SSCService = require("../services").SSC;
const kue = require('kue');
const dotenv = require('dotenv').config();
const queue = kue.createQueue({redis: process.env.REDIS_URL});
module.exports = (config) => {
View index.js
const jwt = require('jwt-express');
const bodyParser = require('body-parser');
const controllers = require('../controllers');
module.exports = (app) => {
app.get('/', (req, res) => res.status(200).send({
message: 'Welcome to the API!',
bunlongheng / Fortinet.php
Created March 6, 2018 19:33
Fortinet Model API between the portal
View Fortinet.php
namespace App\Models;
use App\CURL;
use Redirect;
use Session;
$GLOBALS['FG_API'] = '';
if [ -d $path ]
echo "Directory $path exists."
echo "Remove old path"
rm -rf $path
echo "Create new path"
mkdir $path