Skip to content

Instantly share code, notes, and snippets.

View gfnord's full-sized avatar
🏠
Working from home

Gustavo F Nobrega gfnord

🏠
Working from home
View GitHub Profile
@gfnord
gfnord / aws_devops_docs.txt
Last active September 8, 2021 18:23
Reference Links for AWS Certified DevOps Engineer Professional
Reference Links for AWS Certified DevOps Engineer Professional
I use the documentation a lot in this course. Here are all the links that are visited during this section. I recommended you read through them in your own time, as I judge them to have some importance for your understanding of the services and the exam. Happy reading!
CodeCommit
https://www.atlassian.com/git/tutorials/using-branches
https://docs.aws.amazon.com/codecommit/latest/userguide/auth-and-access-control-iam-identity-based-access-control.html
@gfnord
gfnord / search_islands.py
Last active June 10, 2021 21:39
search islands 2d array
def count_islands(input):
# if there is no input, return 0
if not input:
return 0
# get the size of the array
row = len(input)
col = len(input[0])
count = 0
@gfnord
gfnord / xen_backup_vm.sh
Last active April 14, 2021 21:09
XCP-NG/Xenserver/Xen VM backup bash script
#!/bin/bash
TARGET=$1
BACKUP_LOCATION=/backup/XVA
VMS_LIST=/tmp/.vms_list_000
if [ -z "$1" ]; then
echo "No vmname found"
echo "Usage: ./backup_vm.sh VMNAME"
exit 0
fi
@gfnord
gfnord / gist:989903bb42e269f64e7c82ea71a1317b
Created December 9, 2019 17:31
Some things every C programmer should know about C
Some things every C programmer should know about C
PMK 10-16-2002
Types
-----
Every constant, object, function, and expression in C has a type.
Most generally, a type is either an unqualified type or such a type
qualified with "const", "volatile", or both qualifiers. Unqualified
@gfnord
gfnord / tohex.c
Created September 9, 2019 21:36
bin to hex function in C
void tohex(unsigned char * in, size_t insz, char * out, size_t outsz)
{
unsigned char * pin = in;
const char * hex = "0123456789ABCDEF";
char * pout = out;
for(; pin < in+insz; pout +=2, pin++){
pout[0] = hex[(*pin>>4) & 0xF];
pout[1] = hex[ *pin & 0xF];
if (pout + 2 - out > outsz){
# basic pfctl control
# ==
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
#!/bin/bash
# Script will output dumps for all databases using seperate files
USER="root"
HOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
OUTPUT_DIR="/backup/MySQL_Backup"
# Parse options

Keybase proof

I hereby claim:

  • I am gfnord on github.
  • I am gfnord (https://keybase.io/gfnord) on keybase.
  • I have a public key ASAE32VwaaUnfsRLUmF_s_EDt8rG3i727GFF4eWVpdJCOQo

To claim this, I am signing this object:

@gfnord
gfnord / build-nginx.sh
Created November 17, 2016 12:32 — forked from niklasvincent/build-nginx.sh
Build script for statically compiled nginx 1.4.7 with OpenSSL 1.0.1e.
#!/bin/bash
set -e
NGINX_VERSION="1.6.0"
NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz"
PCRE_VERSION="8.34"
PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz"
OPENSSL_VERSION="1.0.1g"
OPENSSL_TARBALL="openssl-${OPENSSL_VERSION}.tar.gz"
@gfnord
gfnord / latest-ffmpeg-centos6.sh
Last active August 16, 2016 14:52 — forked from mustafaturan/latest-ffmpeg-centos6.sh
Installs latest ffmpeg on Centos 6
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
# Just forked the project and added "-y" on yum install to make sure everything will be installed
yum install -y autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz