Skip to content

Instantly share code, notes, and snippets.

Goncalo Gomes gagomes

Block or report user

Report or block gagomes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gagomes
gagomes / spectre.c
Created Jan 15, 2018 — forked from ErikAugust/spectre.c
Spectre example code
View spectre.c
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
@gagomes
gagomes / scan-and-copy-all-images.py
Last active Jan 6, 2018
scan pictures in a given path and copy them out onto another
View scan-and-copy-all-images.py
#!/usr/bin/python
# I used this script to scan pictures in a 15 year old
# windows hard-drive and copy them to a specific folder with a name
# based on an increasing sequence. It also seemed to pick multiple
# formats that weren't exactly the type of pictures I would care about,
# so I filtered for those (icons, bitmaps, etc)
#
import sys
import os
@gagomes
gagomes / abown4.c
Created Jan 5, 2018
A no-bruteforce exploit against abo4 from the "Advanced Buffer Overflow" collection by Gera, written sometime circa 2002--2003
View abown4.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <elf.h>
@gagomes
gagomes / regex_match.md
Last active Sep 19, 2017
Rough translation of the C version of the regex parser by Brian Kernighan from chapter 1 of "Beautiful Code" to Python
View regex_match.md
#!/usr/bin/env python
#
# Harsh translation from C to Python, with minimal python idioms.
# Original code by Brian Kernighan in chapter 1 of Beautiful Code
#
def match(regstr, s):
'''match: search for regexp anywhere in text'''
if regstr.startswith('^'):
return matchhere(regstr[1:], s)
View mysql-hive-one-liners.md

MySQL

list all tables from all databases (Taken from a SO post)

SELECT table_name, table_schema AS dbname FROM INFORMATION_SCHEMA.TABLES
@gagomes
gagomes / chef-one-liners.md
Last active Jan 24, 2017
chef-one-liners
View chef-one-liners.md

Get a list of nodes and their runlists matching a given recipe

knife exec -E 'nodes.find("recipe:*elasticsearch*") { |n| puts "hostname: #{n.name} runlist: #{n.run_list}" }'

View single-docker-instance.sh
#!/bin/bash
NAME=rpmfs
CONTAINER=$(docker ps -q -a --filter name=$NAME)
if test -z "$CONTAINER"; then
docker run --name=$NAME \
-v ${PWD}/../centos/:/data/centos \
-v ${PWD}/../linux:/data/linux \
-v images:/data/images \
View preload.c
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <dlfcn.h>
#include <asm-generic/errno-base.h>
#include <errno.h>
@gagomes
gagomes / gemcat
Last active Nov 18, 2016
a util to display the contents of a ruby gemfile
View gemcat
#!/bin/bash
set -u
GEM=$1
if ! echo $GEM | egrep -qi '\.gem$'; then
echo $1 does not end in .gem
exit 1
fi
You can’t perform that action at this time.