Skip to content

Instantly share code, notes, and snippets.

View jimanx2's full-sized avatar

Haziman Hashim jimanx2

  • ABH Solution Sdn. Bhd.
  • Shah alam
View GitHub Profile
@jimanx2
jimanx2 / phpq
Last active April 26, 2024 03:14
Feeble attempt to mimic `jq` functionality with PHP input. Usage: `echo filename.php | phpq '$.attr1.subattr1'`
#!/usr/bin/env php
<?php
$syntax = !empty($argv[1]) ? $argv[1] : "\$";
$input = preg_replace("/^<\?php/", "", trim(file_get_contents("php://stdin")));
$defvars = array_keys(get_defined_vars());
$parsed = eval($input);
$vars = get_defined_vars();
@jimanx2
jimanx2 / appium_webdriver.py
Created September 28, 2021 05:03
How to reconnect to existing session in appium server
from typing import Any, Dict, List, Optional, TypeVar, Union
from appium import webdriver
class AppiumWebDriver(webdriver.Remote):
def __init__(
self,
session_id: None,
command_executor: str = 'http://127.0.0.1:4444/wd/hub',
browser_profile: str = None,
proxy: str = None,
@jimanx2
jimanx2 / conduct
Last active July 15, 2021 08:42
`conduct` bash script for working with multiple docker-compose.yaml file in one project
#!/bin/bash
# /usr/local/bin/conduct
pushd . > /dev/null 2>&1 && popd > /dev/null 2>&1
if [ -f .env ] && [ $(grep -U $'\x0D' .env | wc -l ) -gt 0 ]; then
echo "ERROR: .env contains CRLF!"
echo "Refusing to work."
exit 1
@jimanx2
jimanx2 / AgentDeploymentScript.sh
Last active February 7, 2024 11:25
TrendMicroDeepSecurityInstallScript
#!/bin/bash
ACTIVATIONURL='dsm://agents.deepsecurity.trendmicro.com:443/'
MANAGERURL='https://app.deepsecurity.trendmicro.com:443'
CURLOPTIONS='--silent --tlsv1.2'
linuxPlatform='';
isRPM='';
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo You are not running as the root user. Please try again with root privileges.;
@jimanx2
jimanx2 / bin[slash]appctl
Last active September 12, 2017 17:05
Simple script to manage puma, resque and resque-scheduler as services
#!/bin/bash
APP=<appname> # directory for this appname must exist!
APPDIR=/var/www/$APP
stop() {
if [ -z "$1" ] || [ "$1" == "web" ]; then
PUMA_PID=`cat $APPDIR/$APP.pid 2>/dev/null`
if [ -n "$PUMA_PID" ]; then
using System;
using System.Threading.Tasks;
using DPFP.Capture;
namespace DPFingerTest
{
using System;
using System.Threading.Tasks;
using DPFP.Capture;
var ScriptQueue = function(){
var $this = this;
var cbStack = [];
var currentCbIndex = -1;
this.cbTimers = {};
this.queue = function(cb){
cbStack.push(cb);
return $this;
}
<?php
class ORM extends CI_Model {
var $table_name, $fields;
function __construct($subclass = NULL){
parent::__construct();
$this->load->helper('inflector');
}
function initialize(){