Skip to content

Instantly share code, notes, and snippets.

View bernardoamc's full-sized avatar

Bernardo de Araujo bernardoamc

View GitHub Profile
@bernardoamc
bernardoamc / basicbof.c
Created November 10, 2023 22:17 — forked from moyix/basicbof.c
Buffer overflow with two ROP chains
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
// Build:
// gcc -gdwarf-4 -fcf-protection=none -no-pie -fno-stack-protector basicbof.c -o basicbof
// To give us a pop rdi gadget
void dosomething() {
int x = 0xc35f;
@bernardoamc
bernardoamc / push-to-someone-elses-pr.md
Created June 9, 2023 15:32 — forked from wtbarnes/push-to-someone-elses-pr.md
Brief instructions for how to modify and push to someone else's PR on github

How to Push to Someone Else's Pull Request

Let's say contributor has submitted a pull request to your (author) project (repo). They have made changes on their branch feature and have proposed to merge this into origin/master, where

origin -> https://github.com/author/repo.git

Now say you would like to make commits to their PR and push those changes. First, add their fork as a remote called

This is explaining stuff relevant to AOC 2021 day 6

How is a matrix used to count fish?

First lets do fibonacci numbers because it's smaller (2x2 matrix instead of 9x9) and it's familiar ground.

So you can implement fibs like this:

def fib(n):
@bernardoamc
bernardoamc / style.css
Created July 16, 2019 01:41
Style CSS
main {
width: 100%;
padding: 15px;
}
.catalogue-item {
border: 1px solid #e5e5e5;
color: #555;
display: block;
padding: 2rem 0;
@bernardoamc
bernardoamc / EchoServer.py
Created October 24, 2018 15:30 — forked from limingzju/EchoServer.py
A simple Python echo server, show how to write socket program use python.
# Echo server program
import socket
HOST = '' # Symbolic name meaning all available interfaces
PORT = 50007 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
@bernardoamc
bernardoamc / xml-attacks.md
Created July 11, 2018 03:00 — forked from mgeeky/xml-attacks.md
XML Vulnerabilities and Attacks cheatsheet

XML Vulnerabilities

XML processing modules may be not secure against maliciously constructed data. An attacker could abuse XML features to carry out denial of service attacks, access logical files, generate network connections to other machines, or circumvent firewalls.

The penetration tester running XML tests against application will have to determine which XML parser is in use, and then to what kinds of below listed attacks that parser will be vulnerable.


@bernardoamc
bernardoamc / one-liners.md
Created January 17, 2018 19:30 — forked from KL-7/one-liners.md
Ruby one-liners

One-liners

Reverse every line:

Input file:

$ cat foo
qwe
123

bar

@bernardoamc
bernardoamc / blog_link.rb
Created November 8, 2017 20:28
Custom delegation
@bernardoamc
bernardoamc / phoenix_preact_polaris.md
Created November 7, 2017 03:46 — forked from joshnuss/Phoenix-Preact-Polaris.md
Setup a Phoenix Server with Preact & Polaris

HOWTO: Configure Phoenix with Preact & Polaris

  1. Create a Phoenix app
# create the app
mix phx.new my_app --no-ecto --module MyApp --app my_app

# go to my_app
@bernardoamc
bernardoamc / watcher.sh
Created July 1, 2016 14:46 — forked from josevalim/watcher.sh
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
# You will need fswatch installed (available in homebrew and friends)
# The command below will run tests and wait until fswatch writes something.
# The --stale flag will only run stale entries, it requires Elixir v1.3.
fswatch lib/ test/ | MIX_ENV=test mix do test --stale, run --no-halt -e "IO.gets(:stdio, ''); IO.puts 'Restarting...'; :init.restart()"