Skip to content

Instantly share code, notes, and snippets.

View terremoth's full-sized avatar
🌄
Open to work. #HireMe #OpenToWork

Lucas M. Dutra terremoth

🌄
Open to work. #HireMe #OpenToWork
View GitHub Profile
@terremoth
terremoth / dd.php
Last active December 11, 2023 23:20
Simple DD like tool made in PHP, just change the disk you want to read and dump
<?php
echo "Disk size: ".disk_total_space("D:").PHP_EOL;
$disk = fopen('\\\\.\\D:', 'rb+'); //escaping the escape
$chunk_size = 4096;
while (!feof($disk)) {
$bin_data = fread($disk, 4096);
@terremoth
terremoth / mbr.php
Last active December 11, 2023 17:55
Check the MBR or GPT content from the Disk. Works for cli and web
<?php
$is_terminal = php_sapi_name() == "cli";
$td_tag_init = "\t".'<td>';
$td_tag_end = '</td>'.PHP_EOL;
$tr_tag_init = '<tr>'.PHP_EOL;
$tr_tag_end = '</tr>'.PHP_EOL;
$to_html_init = '&#';
$to_html_end = ';';
$new_line_code = '<br>'.PHP_EOL;
@terremoth
terremoth / quanto_cobrar.js
Last active December 7, 2024 00:27
Quando cobrar bruto por algo para saber quanto quer ganhar, sabendo que vai ter uma taxa de desconto em cima do preço
function quanto_cobrar(quanto_quero_ganhar, taxa_de_desconto) {
let i = 0;
function loop(valor) {
let resultado = parseFloat((valor - (valor * taxa_de_desconto)).toFixed(2));
let acrescentar = parseFloat((valor - resultado).toFixed(2));
if (i === 10) {return quanto_quero_ganhar + acrescentar;}i++;
@terremoth
terremoth / available_default_python_packages.py
Last active November 15, 2023 14:14
Prints to the screen all available and usable Python Modules installed
#!/usr/bin/env python
"""Prints to the screen all available and usable Python Modules (that aren't pip packages) installed
and display their description"""
import importlib
import os
import pkgutil
import platform
import re
@terremoth
terremoth / grub.cfg
Created September 27, 2023 18:05
Grub disable mitigations
GRUB_CMDLINE_LINUX="noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off mitigations=off"
@terremoth
terremoth / key.php
Last active November 4, 2024 05:54
key.php
<?php
//echo "\033[23\033[;H";
require_once 'vendor/autoload.php';
$struct = new \danog\PHP\StructClass();
function is_little_endian() {
$testint = 0x00FF;
$p = pack('S', $testint);
@terremoth
terremoth / pygame_tkinter_exe_examples.sh
Last active August 23, 2023 03:03
Python pygame + tkinter to .exe with icon and not showing console (prompt) examples
# suppose the main file to load is main.py and the icon file is called main.ico, the process is this:
python -m nuitka --enable-plugin=tk-inter --onefile --disable-console --windows-icon-from-ico=main.ico main.py
pyinstaller --onefile --icon=main.ico --noconsole main.py
cxfreeze -c main.py --icon=main.ico --base-name=Win32GUI --target-dir distcx
@terremoth
terremoth / mandelbrot.js
Created October 15, 2022 12:34
Mandelbrot Algorithm
let canvas = document.getElementById('universe').getContext('2d')
let atom = (x,y,c) => {canvas.fillStyle = c; canvas.fillRect(x,y,3,3)};
window.CP.PenTimer.MAX_TIME_IN_LOOP_WO_EXIT = 10000;
for (y=1; y < 1000; y++) {
for (x=1; x < 1000; x++) {
dx = (x-500)/200
dy = (y-500)/200
a = dx
@terremoth
terremoth / sum_without_plus_sign.js
Created October 15, 2022 12:32
Sum without "+" operator using bitwise
function soma(first, second) {
while (second != 0) {
var carry = first & second;
first = first ^ second;
second = carry << 1;
}
return first;
@terremoth
terremoth / remove_prohibited.js
Created August 7, 2022 18:22
remove prohibited chars from string
function newName(name) {
return name.toLowerCase().split('').map((char) => {
if(['e','r','t','y','u','i','a','s','k','l','b','n','m'].find(prohibited => prohibited === char)) {
return null;
}
return char;
}).join('');
}
console.log(newName("joãozinho da silva sauro"));