Skip to content

Instantly share code, notes, and snippets.

View seisvelas's full-sized avatar
🦊
const sh = network.pop(shell); sh.write({recipient:'admin'}, 'nice system!');

Xandre V seisvelas

🦊
const sh = network.pop(shell); sh.write({recipient:'admin'}, 'nice system!');
View GitHub Profile
@seisvelas
seisvelas / backspace.asm
Last active December 27, 2020 03:22
String with backspaces function in ASM - broken because I can't correctly move one byte between two pointers
global strclr
extern printf
extern malloc
section .text
strclr:
sub rsp, 8
; callee reserved registers
push rbx
@seisvelas
seisvelas / function_ptr_VERSUS_label_addr.c
Last active December 25, 2020 08:36
Is a function pointer just the address of the label?
#include <stdio.h>
#include <stdint.h>
/*
Test whether a function pointer is really just
a pointer to the memory location of a label.
Which would make sense, only I never really looked
into function pointers, so I'm curious if this is
what they are.
@seisvelas
seisvelas / bus.asm
Last active December 24, 2020 08:49
Solution to the bus toy problem Khety created for me
global busString
extern sprintf
section .data
busStringFormat: db "%ld more people are allowed onto the bus.", 10, 0
busOutOfSpace: db "No more people can fit on the bus.", 10, 0
section .bss
output_buff: resb 5000
@seisvelas
seisvelas / fib_recur.asm
Last active December 13, 2020 08:26
x64 implementation of the f(n)=f(n-1)+f(n-2) fibonacci algorithm
global fibonacci
extern printf
fibonacci:
xor rax, rax
; f(n = 1|0) = n
cmp rdi, 1
jle identity
; f(n > 1) = f(n - 1) + f(n - 2)
@seisvelas
seisvelas / khety_ssh.sh
Created December 8, 2020 04:58
Script for Khety to easily SSH into Fatima's laptop with my user
ssh alex@$(nmap -sn 192.168.1.0/24 | grep fatima | awk '{ print $6 }' | sed -e 's/(\|)//g')
@seisvelas
seisvelas / less.asm
Created December 3, 2020 06:06
assembly toy problem
global main
extern printf
SECTION .text
small_enough:
mov rax, 1
add rsi, 1
;rdi array, rsi array length, rdx limit
loop:
@seisvelas
seisvelas / cb_quotes.py
Created November 24, 2020 07:57
Script to collect lots of quotes from cockbox.org (VPS site) quote section
import urllib.request
from bs4 import BeautifulSoup
quotes = []
for i in range(10_000):
try:
fp = urllib.request.urlopen("https://www.cockbox.org")
cockbytes = fp.read()
cockstr = cockbytes.decode("utf8")
@seisvelas
seisvelas / push.sh
Created November 7, 2020 04:33
Easier git pushes
#!/bin/bash
git push 2> /dev/null
if [ $? -eq 128 ]
then
$(git push 2>&1 \
| grep 'git push') 2>&1 \
| grep https \
| awk '{ print $2 }' \
| xargs firefox
@seisvelas
seisvelas / baby-lisp.rkt
Last active October 12, 2020 16:48
Solution to cassidoo newsletter baby lisp problem
#lang racket/base
; unit tests
(require rackunit)
; Give (eval expr namespace) access to
; the current namespace via the label ns
(define-namespace-anchor a)
(define ns (namespace-anchor->namespace a))
@seisvelas
seisvelas / btree.py
Last active October 3, 2020 03:22
Solution to programming challenge (print binary tree elements in order) from https://www.youtube.com/watch?v=OTfp2_SwxHk
class BinaryTree:
left = None
right = None
value = None
def __init__(self, *initial):
self.value = initial.pop(0)
for i in initial:
self.add(i)