Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Ilgrim / GoogleAuthenticationCurl.sh
Created September 15, 2022 23:33 — forked from LindaLawton/GoogleAuthenticationCurl.sh
Curl bash script for getting a Google Oauth2 Access token
# Tutorial https://www.daimto.com/how-to-get-a-google-access-token-with-curl/
# YouTube video https://youtu.be/hBC_tVJIx5w
# Client id from Google Developer console
# Client Secret from Google Developer console
# Scope this is a space seprated list of the scopes of access you are requesting.
# Authorization link. Place this in a browser and copy the code that is returned after you accept the scopes.
https://accounts.google.com/o/oauth2/auth?client_id=[Application Client Id]&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=[Scopes]&response_type=code
# Exchange Authorization code for an access token and a refresh token.
@Ilgrim
Ilgrim / Makefile
Created July 30, 2022 21:20 — forked from woodworker/Makefile
Template Makefile project for STM8 SDCC builds
SDCC = sdcc
STM8FLASH = stm8flash
STLINK=stlinkv2
CHIP = STM8S103
CHIP_TYPE = STM8S103F3
CHIP_TYPE_LCASE = $(shell echo $(CHIP_TYPE) | tr '[:upper:]' '[:lower:]')
CFLAGS = -lstm8 -mstm8 -L./libsrc/build/ -l./libsrc/stm8s_stdlib.a -I./libsrc/inc -D$(CHIP) -DUSE_STDPERIPH_DRIVER
@Ilgrim
Ilgrim / avr-gcc mega2560 Makefile
Created July 19, 2022 11:24 — forked from rkrd/avr-gcc mega2560 Makefile
Makefile for building pure C programs on a arduino mega 2560 with avrdude and avr-gcc. Strongly based on the one found on: http://www.1010.co.uk/org/avr_resources.html
NAME := main
HEX := $(NAME).hex
OUT := $(NAME).out
MAP := $(NAME).map
SOURCES := $(wildcard *.c)
HEADERS := $(wildcard *.h)
OBJECTS := $(patsubst %.c,%.o,$(SOURCES))
MCU := atmega2560
MCU_AVRDUDE := m2560
@Ilgrim
Ilgrim / gpg-symmetrical-example.py
Created July 14, 2022 19:44 — forked from serxoz/gpg-symmetrical-example.py
GPG Symmetrical Example
import gnupg
gpg = gnupg.GPG()
# cifrado simétrico
vaca = gpg.encrypt("esto é unha proba", [], symmetric=True, passphrase='1234')
print(vaca.data)
# b'-----BEGIN PGP MESSAGE-----\n\njA0EBwMCPaDu/4KW8In40kYBvzWul1ccpl4+GP4YVZHv4ppEZ3JydNIKPQViMvhO\nIndNIr2/+3dKFqifBQdZQiAr4X3U3R0QKeWbi1XOcGecPoj5L90m\n=dHQ6\n-----END PGP MESSAGE-----\n'
# descifrado
boi = gpg.decrypt(vaca.data, passphrase='1234')

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@Ilgrim
Ilgrim / basic-freebsd-bridge.sh
Created June 4, 2022 02:55 — forked from rubenerd/basic-freebsd-bridge.sh
Basic HP MicroServer FreeBSD bridge with 4-port NIC
######
## Basic FreeBSD bridge for HP MicroServer and 4-port PCI-E NIC
## Details from dmesg:
## - <HP Ethernet 1Gb 2-port 332i Adapter, ASIC rev. 0x5720000>
## - <Intel(R) PRO/1000 Network Connection 7.6.1-k>
set -e
cat >> /boot/loader.conf <EOF
## Add network bridge support
@Ilgrim
Ilgrim / app.py
Created May 29, 2022 23:25 — forked from blakebjorn/app.py
Example communication between flask application and python worker using zeroMQ
import zmq
from flask import Flask
from threading import Thread
HOST = '127.0.0.1'
PORT = 9090
TASK_SOCKET = zmq.Context().socket(zmq.REQ)
TASK_SOCKET.connect('tcp://{}:{}'.format(HOST, PORT))
app = Flask("app")
@Ilgrim
Ilgrim / samba-ad-dc-howto.md
Created May 11, 2022 20:10 — forked from oneohthree/samba-ad-dc-howto.md
samba-ad-dc-howto.md

Instalación de Samba como Active Directory Domain Controller (AD DC)

Consideraciones previas

  • Sistema operativo: Debian GNU/Linux 9 (Stretch)
  • Nombre de host: dc
  • Nombre de dominio: foo.bar
  • Dirección IP: 192.168.0.1

Configuración de nombres de hosts

@Ilgrim
Ilgrim / ARMDebianUbuntu.md
Created May 10, 2022 07:56 — forked from Liryna/ARMDebianUbuntu.md
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@Ilgrim
Ilgrim / port_manipulation.cpp
Created May 5, 2022 14:36 — forked from nadavmatalon/port_manipulation.cpp
Arduino: Port Manipulation
// DDRD (R/W) pin direction (0 = INPUT / 1 = OUTPUT)
// PORTD (R/W) pin state (INPUT: 0 = LOW / 1 = HIGH | OUTPUT: 0 = PULL-UP DIACTIVATED / 1 = PULL-UP ACTIVATED)
// PIND (R) pin state (INPUT ONLY: 0 = LOW / 1 = HIGH)
// bit(n) // calculates value of n-th bit (returns: 0 / 1)
// bitRead(byteName, n) // gets value of n-th bit of byte (returns: 0 / 1)
// bitSet(byteName, n) // sets value of n-th bit of byte to 1
// bitClear(byteName, n) // sets value of n-th bit of byte to 0
// bitWrite(byteName, n, val) // sets value of n-th bit of byte to 0 or 1