Skip to content

Instantly share code, notes, and snippets.

@Ilgrim
Ilgrim / perlbot.pl
Created September 25, 2022 23:20 — forked from bssanchez/perlbot.pl
IRC bot in perl
#!/usr/bin/perl
use strict;
use IO::Socket;
################################################################
# Prueba perl de botIRC #
# Objetivo del proyecto aprender manejo de perl con algunas #
# de sus funciones y sobre todo sockets xD... #
# #
@Ilgrim
Ilgrim / irc.bot.0.1.py
Created September 23, 2022 11:24 — forked from 11fl/irc.bot.0.1.py
IRC bot python 3
# -*- coding: utf-8 -*-
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = '' #irc server
PORT = 6665 #port
NICK = 'pony_bot'
USERNAME = 'megadeath'
REALNAME = 'little pony'
@Ilgrim
Ilgrim / main.rs
Created September 23, 2022 08:58
Async echo server with rust and tokio
/*
Exemplo de servidor de eco asíncrono
*/
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpStream};
use std::{env, io};
#[tokio::main]
async fn main() -> io::Result<()> {
@Ilgrim
Ilgrim / google-api.php
Created September 15, 2022 23:35 — forked from dbjpanda/google-api.php
Google API Ouath2 authentication using PHP and Curl
<?php
$end_point = 'https://accounts.google.com/o/oauth2/v2/auth';
$client_id = 'YOUR_ID';
$client_secret = 'YOUR_SECRET';
$redirect_uri = 'http://'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]'; // http://'.$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"] or urn:ietf:wg:oauth:2.0:oob
$scope = 'https://www.googleapis.com/auth/drive.metadata.readonly';
$authUrl = $end_point.'?'.http_build_query([
@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