Skip to content

Instantly share code, notes, and snippets.

@yudhiwidyatama
yudhiwidyatama / sketch_may5a.ino
Created May 6, 2024 01:21
water level monitoring and pump control using arduino uno
uint8_t trigPin=12;
uint8_t echoPin=11;
uint8_t relayPin=10;
long duration;
float distance;
void setup() {
Serial.begin(9600);
Serial.println("Uno level detector started");
pinMode(LED_BUILTIN, OUTPUT);
pinMode(trigPin, OUTPUT);
@yudhiwidyatama
yudhiwidyatama / syncfile.py
Created June 4, 2023 03:23
python code to copy file to remote server using sftp, with 5x retry
import subprocess
import warnings
# Suppress the deprecation warning from the cryptography module.
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import cryptography
import sys
import pysftp
import paramiko
import os
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@yudhiwidyatama
yudhiwidyatama / testrun.e2e.txt
Created November 17, 2020 09:57
test run end to end zeppelin web
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.zeppelin:zeppelin-web >------------------
[INFO] Building Zeppelin: web Application 0.9.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-checkstyle-plugin:2.17:check (checkstyle-fail-build) @ zeppelin-web ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce) @ zeppelin-web ---
[INFO]
@yudhiwidyatama
yudhiwidyatama / dumpphpstack.gdbscript
Created August 22, 2020 09:54
Dump PHP stack for PHP 7.0.27 non-TS, tested on CentOS Linux release 7.7.1908 with Software Collections PHP 7.0
set $exglobal = (long *)&executor_globals
set $currentExecute = (long*)($exglobal[60])
if ($currentExecute != 0)
while ($currentExecute != 0)
set $currentFunc = (long*)$currentExecute[3]
set $currentScope = (long *)$currentFunc[2]
if ($currentScope ==0)
printf ""
else
set $currentScopeN = (long*)$currentScope[1]
@yudhiwidyatama
yudhiwidyatama / dumpphpstack.gdbscript
Last active April 18, 2022 14:28
Dump PHP stack for PHP 7.3.11, tested on CentOS 7.6.1810 with Software Collections PHP 7.3
set $exglobal = (long *)&executor_globals
set $currentExecute = (long*)($exglobal[61])
if ($currentExecute != 0)
while ($currentExecute != 0)
set $currentFunc = (long*)$currentExecute[3]
set $currentScope = (long *)$currentFunc[2]
if ($currentScope ==0)
printf ""
else
set $currentScopeN = (long*)$currentScope[1]
@yudhiwidyatama
yudhiwidyatama / dumpphpstack.gdbscript
Last active August 22, 2020 09:04
Dump php stack for PHP 7.1.8 non-TS, tested on Centos 7.5.1804 with Software Collections PHP 71. Also works on PHP 7.2.24 on CentOS 7.6.181 / Software Collection PHP 72
set $exglobal = (long *)&executor_globals
set $currentExecute = (long*)($exglobal[60])
if ($currentExecute != 0)
while ($currentExecute != 0)
set $currentFunc = (long*)$currentExecute[3]
set $currentScope = (long *)$currentFunc[2]
if ($currentScope ==0)
printf ""
else
set $currentScopeN = (long*)$currentScope[1]
@yudhiwidyatama
yudhiwidyatama / checkinfrav2.rb
Created August 8, 2020 05:00
check infra nodes for anomaly / spike
require "yaml"
hosts = ["infra1","infra2","infra3"]
WORKDIR="/home/telegram/ALERT_TELEGRAM"
WORKDIR2="/root/ALERT_TELEGRAM"
TELEGRAM_USER="OPENSHIFT_ALERT"
TELEGRAM_BASE2="#{WORKDIR2}/telegram_send.sh #{TELEGRAM_USER}"
hostsFull = []
hosts.each {
| h|
hostsFull.push(h + ".paas.telkom.co.id")
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
@yudhiwidyatama
yudhiwidyatama / WebResourcesDecoder.aspx
Created June 2, 2020 01:54
This is for decoding encrypted WebResources axd urls..
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Web.Configuration" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Drawing" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>