Skip to content

Instantly share code, notes, and snippets.

@motebaya
motebaya / asmtool.py
Created April 17, 2024 18:02
simple script that help me to RE python bytecode
#!/usr/bin/python3.11
# it help me for RE, @github.com/motebaya
# useless tool :) tools 17.04.2024
from typing import Dict
from xdis import magics
import re, os, types, marshal, argparse
class Asmtool:
def __init__(self) -> None:
@motebaya
motebaya / concurrency-vs-parallelism-io.rb
Last active March 24, 2024 14:33
diving deeper and experiment with concurrency and parallelism in Ruby for I/O bound operations.
#!/usr/bin/ruby
# copyright - 2024.03.12 motebaya
require "async"
require "async/barrier"
require "async/http/internet"
require "benchmark"
require "httparty"
require "concurrent"
require "parallel"
@motebaya
motebaya / solve_gdb.md
Last active February 23, 2024 10:12
GDB: ptrace: Operation not permitted.
This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.ubuntu.com>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
Downloading separate debug info for /usr/bin/php7.4
(No debugging symbols found in /usr/bin/php7.4)                                               
(gdb) attach 350091
Attaching to program: /usr/bin/php7.4, process 350091
set debuginfod-url "https://debuginfod.ubuntu.com"
set debuginfod-index-urls "https://debuginfod.ubuntu.com"
set debuginfod enabled on
@motebaya
motebaya / Microsoft.PowerShell_profile.ps1
Last active April 5, 2024 06:35
personal windows powershell config
# theme
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/craver.omp.json" | Invoke-Expression
# aliases
New-Alias py python310
New-Alias rb ruby
# Omp history
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
@motebaya
motebaya / agWallpaperHd.js
Last active March 17, 2024 20:38
Aether Gazer Global/Cn Wallpaper HD downloader with native node js module. moved to -> https://github.com/motebaya/AgwpHd for easy maintenance
#!/usr/bin/env node
const https = require("node:https");
const path = require("node:path");
const fs = require("fs");
/**
* aether gazer global wallpaper downloader.
* @gist.github.com/motebaya at 26.11.2023 - 1.24PM
* credit: davins/mochino
@motebaya
motebaya / kuro_wp.sh
Created November 21, 2023 14:01
PGR wallpaper auto downloader shell script. site: https://pgr.kurogame.net/wallpapers
#!/usr/bin/bash
# @gist.github.com/motebaya at 21.11.2023 - 8.57PM
extract() { outputWp="Pgr_Wallpaper";if [[ ! -d "$outputWp" ]];then mkdir -p "$outputWp";echo -e " [*] Output: $(realpath $outputWp)";fi;i=1;pictureList=$(curl -s -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" -L "https://media-cdn-zspms.kurogame.net/pnswebsite/website2.0/json/G167/MainMenu.json" | jq '.picture' | jq '[.[] | select(.imgUrl)]' | jq -c '.[]');while IFS="\n" read -r url; do target=$(jq -r '.imgUrl' <<<$url);echo -e " [*] Downloading [\x1b[32m$target\x1b[0m] Wallpaper: $i of $(wc -l <<<\"$pictureList\")";wget -qnc --show-progress "$target" -P "$outputWp";((++i));trap 'echo " [*] Remove Uncompleted: $outputWp/$(basename $target)"; rm -rf "$outputWp/$(basename $target)"; exit 1;' SIGINT ;done <<<"$pictureList";};extract
@motebaya
motebaya / axios_logging.js
Created October 4, 2023 09:09
axios client logger with winston & axios-logger
import axios from "axios";
import winston from "winston";
import * as AxiosLogger from "axios-logger";
// https://github.com/winstonjs/winston#formats
const logger = winston.createLogger({
level: "debug",
format: winston.format.combine(
winston.format.colorize(),
winston.format.timestamp({ format: "HH:mm:ss" }),
@motebaya
motebaya / downloader.js
Last active September 26, 2023 19:04
Asynchronous node js file downloader with progress bar
#!/usr/bin/node
const axios = require("axios");
const progress = require("cli-progress");
const fs = require("fs");
const async = require("async");
// https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string
const filesize = (a, b, c, d, e) => {
return (
((b = Math),
@motebaya
motebaya / download_progress.php
Last active October 4, 2023 09:12
php download progress bar with guzzlehttp & symfony/console
<?php
include "./vendor/autoload.php";
use \GuzzleHttp\Client;
use \Symfony\Component\Console\Helper\ProgressBar;
use \Symfony\Component\Console\Output\ConsoleOutput;
/**
* https://stackoverflow.com/questions/15188033/human-readable-file-size