Skip to content

Instantly share code, notes, and snippets.

View jpedro's full-sized avatar
🐤
"True courage is knowing you’re wrong but refusing to admit it"

Pedro Barbosa jpedro

🐤
"True courage is knowing you’re wrong but refusing to admit it"
View GitHub Profile
@jpedro
jpedro / shellcode.c
Created November 16, 2017 01:24 — forked from securitytube/shellcode.c
C Program to test shellcode
#include<stdio.h>
#include<string.h>
unsigned char code[] = \
"\x31\xc0\x50\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69\x89\xe3\x50\x89\xe2\x53\x89\xe1\xb0\x0b\xcd\x80";
main()
{
printf("Shellcode Length: %d\n", strlen(code));
@jpedro
jpedro / aes-cbc.py
Created April 5, 2018 11:04 — forked from lopes/aes-cbc.py
Simple Python example of AES in CBC mode.
from hashlib import md5
from base64 import b64decode
from base64 import b64encode
from Crypto import Random
from Crypto.Cipher import AES
# Padding for the input string --not
# related to encryption itself.
BLOCK_SIZE = 16 # Bytes
@jpedro
jpedro / harden.sh
Created May 3, 2018 11:18 — forked from jumanjiman/harden.sh
hardening script for an alpine docker container
#!/bin/sh
set -x
set -e
#
# Docker build calls this script to harden the image during build.
#
# NOTE: To build on CircleCI, you must take care to keep the `find`
# command out of the /proc filesystem to avoid errors like:
#
# find: /proc/tty/driver: Permission denied
@jpedro
jpedro / ensure-cert-macos.sh
Created May 26, 2018 00:48 — forked from koop/ensure-cert-macos.sh
Ensures a certificate is in the macOS system keychain.
#!/bin/bash
# Usage
# $ ./install-cert-macos.sh "/path/to/cert"
CERT_PATH="$1"
# First, grab the SHA-1 from the provided SSL cert.
CERT_SHA1=$(openssl x509 -in "$CERT_PATH" -sha1 -noout -fingerprint | cut -d "=" -f2 | sed "s/://g")
# Next, grab the SHA-1s of any standard.dev certs in the keychain.
# Don't return an error code if nothing is found.
@jpedro
jpedro / LICENCE SUBLIME TEXT
Created May 28, 2018 07:13 — forked from cprakashagr/LICENCE SUBLIME TEXT
Sublime Text 3 Serial key build is 3143
## Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
@jpedro
jpedro / README.md
Created March 29, 2019 00:21 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@jpedro
jpedro / server.py
Created October 16, 2019 17:41 — forked from martijnvermaat/server.py
SimpleHTTPServer with history API fallback
#!/usr/bin/env python
"""
Modification of `python -m SimpleHTTPServer` with a fallback to /index.html
on requests for non-existing files.
This is useful when serving a static single page application using the HTML5
history API.
"""
@jpedro
jpedro / blog.md
Created March 5, 2020 18:44 — forked from mattstauffer/blog.md
Serving Statamic data from in-memory cache

Ed Finkler (Funkatron) asked me, in response to my recent article introducing Statamic, whether you could change Statamic's settings to serve from something other than the local disk.

I checked with Jason & Jack at Statamic, and they told me three things:

  1. Statamic already has the ability (if configured a certain way) to compile all the files down to HTML. It's possible (I don't know how yet, but I know it is) to configure Nginx to serve those files directly.
  2. Statamic v1 has a static site generator built-in, and v2 will get one soon.
  3. Since Statamic's .env file effects the behavior of its Laravel core, you can change the cache driver that your Statamic app is using just like you would in any Laravel app. Just add a CACHE_DRIVER key in .env file and set it to any of the options: 'file', the default; 'database'; 'memcached'; 'redis';
@jpedro
jpedro / SSL-certs-OSX.md
Created March 11, 2020 16:49 — forked from croxton/SSL-certs-OSX.md
Generate ssl certificates with Subject Alt Names

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

@jpedro
jpedro / add_cert.sh
Created March 11, 2020 18:58 — forked from caleb531/add_cert.sh
Scripts for creating and managing simple SSL certificates on macOS (useful for local HTTPS)
#!/usr/bin/env bash
cert_file="$1"
key_file="$2"
CERT_CONF="$(dirname "${BASH_SOURCE[0]}")"/cert-conf.cfg
if [ ! -f "$cert_file" ]; then
cert_hostname="$3"