Skip to content

Instantly share code, notes, and snippets.

Avatar

Bunlong Heng bunlongheng

View GitHub Profile
View fileCleanUpRecursive.py
# --------------------------------------------------------------
# Goal : Remove file base on input match
# Run : curl 45.55.88.57/code/fileModifier.py | python3
import os
import sys
rootdir = os.path.abspath(os.curdir)
print(rootdir)
View loopThroughAnObject.js
console.log("Environment variables----------------")
let variables = pm.environment.toObject();
console.log(variables)
console.log(typeof (variables)) //object
Object.keys(variables).forEach(function(key) {
console.log(key, variables[key]);
});
console.log("-------------------------------------")
View sendEmail. applescript.applescript
set recipientName to "Zuse"set recipientAddress to "sybunlongheng@gmail.com"set theSubject to "Subject" -- leave empty set theContent to "https://picsum.photos/200/300/?random"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">
<head>
<meta charset="utf 8">
<title>Guru99</title>
</head>
<body ng-app="app">
<h1 ng-controller="HelloWorldCtrl">{{message}}</h1>
<script src="https://code.angularjs.org/1.6.9/angular.js"></script>
<script src="app.js"></script>
View check_compression.sh
#!/bin/bash
function check_compression {
curl -I -H 'Accept-Encoding: gzip,deflate' $1 |grep "Content-Encoding"
}
check_compression http://www.bunlongheng.com/ ;
View vm-cfg-backup.sh
path="/home/benu/backup"
if [ -d $path ]
then
echo "Directory $path exists."
echo "Remove old path"
rm -rf $path
echo "Create new path"
mkdir $path
View rank.php
function containsKey($key_para, $array)
{
foreach ($array as $key => $value) {
if ($key_para === $key) {
return true;
}
}
return false;
}
@bunlongheng
bunlongheng / SkillController.php
Last active Mar 1, 2019
Sample Laravel + Angular CRUD Controller
View SkillController.php
<?php
namespace App\Http\Controllers;
use App\Skill;
use Input, Validator, Auth, Redirect, Request, Session, Mail, View, Image;
class SkillController extends Controller {
//------------------------------------------------------------------------------------------------- [ all ]
View be.master.blade.php
<!DOCTYPE html>
<!--[if IE 9 ]><html class="ie9"><![endif]-->
<head>
@include('layouts.be.meta')
@include('layouts.be.links')
</head>
<body>
@bunlongheng
bunlongheng / ImageController.php
Last active Mar 1, 2019
Sample Laravel CRUD Controller
View ImageController.php
<?php
namespace App\Http\Controllers;
use App\ImageWork;
use Input, Validator, Auth, Redirect, Request, Session, Mail, View, File, Image, SSH;
class ImageController extends Controller {
//------------------------------------------------------------------------------------------------- [ Index ]