Skip to content

Instantly share code, notes, and snippets.

@Ddorda
Ddorda / asmbler.sh
Created March 2, 2020 20:51
Convert assembly to shellcode. include in your bashrc file.
function asmbler()
{
f=$(mktemp)
cat<<EOF>${f}.s
.globl _main
.intel_syntax noprefix
_main:
EOF
@Ddorda
Ddorda / default_electron_menu_template.js
Created May 2, 2019 17:31
Template of the default Electron menu
[{
label: "File",
accelerator: null,
role: "filemenu",
commandId: 2,
submenu: [{
"label": "Quit",
accelerator: null,
role: "quit",
commandId: 1,
@Ddorda
Ddorda / electron_menu_to_template.js
Created May 2, 2019 17:27
Electron Menu to Template
// I wanted to have the default electron menu as template for changes and couldn't find anything online. hope it would help someone....
// I'll upload the result as another gist
function MenuItem2object(item) {
if (item == null){ return null;}
if (item.constructor.name == 'MenuItem') {
return {label: item.label, accelerator: item.accelerator, role: item.role, commandId: item.commandId, submenu: MenuItem2object(item.submenu)}
}
else if ( item.constructor.name == 'Menu') {
return item.items.map(item => MenuItem2object(item))
@Ddorda
Ddorda / slack_rtl_support_win.ps1
Last active April 22, 2018 07:06
Add RTL support for Slack on Windows
# Based on: slack_rtl_support_mac.sh By Oren Yomtov: https://gist.github.com/orenyomtov/3d0f2412afa1c4a9eb207d3d4310e988
# Tested on Win10
# Prerequisites: Node.js
# Node.js can be downloaded from: https://nodejs.org/en/download/
# if can't run scripts, open powershell an run:
# cat path/to/script.ps1 | powershell
Write-Output "Getting Slack Directory"
$slackdir = Get-Process -name 'slack' | Select-Object -First 1 | Select -ExpandProperty "path" | Split-Path
@Ddorda
Ddorda / get_syscall_numbers.py
Created March 25, 2018 13:08
Get Syscalls numbers dynamically from header files
UNISTD_PATH = '/usr/include/x86_64-linux-gnu/asm/unistd_64.h'
def get_syscall_numbers(unistd_path=UNISTD_PATH):
d = {}
with open(unistd_path, 'r') as f:
for line in f.readlines():
if line.startswith('#define __NR_'):
try:
syscall_data = line.strip().split()
d[syscall_data[1].replace('__NR_', '')] = int(syscall_data[2])