Skip to content

Instantly share code, notes, and snippets.

View angeloped's full-sized avatar

Angeloped angeloped

  • Philippines
View GitHub Profile
@angeloped
angeloped / get_serial_number.py
Last active February 2, 2024 09:55
Python code to get motherboard serial number. For Linux, MacOS, and Windows.
# wmic bios get serialnumber#Windows
# hal-get-property --udi /org/freedesktop/Hal/devices/computer --key system.hardware.uuid#Linux
# ioreg -l | grep IOPlatformSerialNumber#Mac OS X
import os, sys
def getMachine_addr():
os_type = sys.platform.lower()
if "win" in os_type:
command = "wmic bios get serialnumber"
elif "linux" in os_type:
command = "hal-get-property --udi /org/freedesktop/Hal/devices/computer --key system.hardware.uuid"
@angeloped
angeloped / cutcopypaste.py
Created June 24, 2019 12:40
A simple Tkinter Cut, Copy, and Paste contextmenu for Entry widgets.
import Tkinter
def make_textmenu(root):
global the_menu
the_menu = Tkinter.Menu(root, tearoff=0)
the_menu.add_command(label="Cut")
the_menu.add_command(label="Copy")
the_menu.add_command(label="Paste")
the_menu.add_separator()
the_menu.add_command(label="Select all")
@angeloped
angeloped / flask_upload.py
Created February 26, 2021 18:05
Upload file with Flask microframework.
import os
from flask import Flask, flash, request, redirect, url_for
from werkzeug.utils import secure_filename
if not os.path.exists("uploads/"):
os.mkdir("uploads")
UPLOAD_FOLDER = 'uploads/'
ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'}
@angeloped
angeloped / imageicon.py
Created February 7, 2019 13:44
Tkinter window example with gif icon display.
from Tkinter import *
root = Tk()
img = PhotoImage(file='b11.gif')
root.tk.call('wm', 'iconphoto', root._w, img)
root.mainloop()
@angeloped
angeloped / MEM_RET.C
Created January 21, 2023 17:38
Memory Retrieval Operation | MHIP kernel component
#include <stdio.h>
#include <math.h>
// Memory Retrieval Operation | MHIP kernel component
// 1/22/2023
// 6 bit address/size
// A B C A B C
// 0 3 [ ] 1 3 [ ]
int SAM[] = {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,1,0,1};
@angeloped
angeloped / angular_size.js
Created July 13, 2022 19:16
angular size function. calculation extracted from https://www.1728.org
/angsize.htm
// angular size https://www.1728.org/angsize.htm
function angular_size(sz, r){
const raddeg = 57.2957795130823;
var arctan = Math.atan( (.5*sz) / r );
return arctan * 2 * raddeg;
}
@angeloped
angeloped / MEM_HOP.C
Created January 21, 2023 17:04
Memory Hopping Operation | MHIP kernel component
#include <stdio.h>
#include <math.h>
// Memory Hopping Operation | MHIP kernel component
// 1/21/2023
// 6 bit address/size
// A B C A B C
// 0 3 [ ] 1 3 [ ]
int SAM[] = {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0,1,1,1,0,1};
@angeloped
angeloped / BOOL_OP.C
Created January 20, 2023 11:57
Boolean Comparing Operation | MHIP kernel component
#include <stdio.h>
// Boolean Comparing Operation | MHIP kernel component
// Bryan Pedrosa
// 1/20/2023
// modes:
//[0x0]BOOL_EQ - equal
//[0x1]BOOL_LT - less than
//[0x2]BOOL_GT - greater than
@angeloped
angeloped / IsTor.url
Created January 19, 2023 07:26
A Torproject API to check if IP connected is configured to Tor.
https://check.torproject.org/api/ip
@angeloped
angeloped / cross_socket.c
Created January 8, 2023 01:09
A truly Cross-Platform socket client written in C language.
#include <stdio.h>
// 1/8/2022
// modified version of https://github.com/ApOgEE/mingw-c-socket
// WORKS ON Linux kali 4.19.0-kali4-686-pae #1 SMP Debian 4.19.28-2kali1 (2019-03-18) i686 GNU/Linux
//////////////////////////////////////////////////////////////////////////
// CROSS-PLATFORMING A SOCKET PROGRAM
// See https://stackoverflow.com/questions/28027937/cross-platform-sockets