Skip to content

Instantly share code, notes, and snippets.

View membrive's full-sized avatar

Fernando Membrive membrive

View GitHub Profile
@membrive
membrive / update_zsh.sh
Created January 3, 2024 12:16
Update my ZSH setup
#!/bin/sh
echo 'Updating Oh-My-ZSH...'
cd ~/.oh-my-zsh
git pull
echo ''
echo 'Updating spaceship-prompt...'
cd ~/.oh-my-zsh/custom/themes/spaceship-prompt
git pull
@membrive
membrive / check_ssl_expiration.py
Created January 3, 2024 12:03
Check the remaining days for the expiration of a domain's SSL certificate.
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Check the remaining days for the expiration of a domain's SSL certificate."""
from datetime import datetime
import argparse
import socket
import ssl
CA_CERTS = './cacert.pem'
@membrive
membrive / filesize_alerts.py
Created January 3, 2024 12:00
Checks if the files in a directory, with a certain filename pattern, exceed a given size.
#!/usr/bin/python
#
# Fernando Membrive
#
# Checks if the files in a directory, with a certain filename pattern,
# exceed a given size.
#
import os
import fnmatch

Keybase proof

I hereby claim:

  • I am membrive on github.
  • I am membrive (https://keybase.io/membrive) on keybase.
  • I have a public key whose fingerprint is 1818 5A13 A3AE 9FF6 0F59 B1E5 FB09 E8A1 CE1F 8C20

To claim this, I am signing this object:

@membrive
membrive / telegram_group_users_stats.py
Last active February 6, 2022 12:48
Creates a table with the message count and the date of the last message of each user of a Telegram group.
#!/usr/bin/env python
from telethon.sync import TelegramClient
from telethon.tl.types import PeerUser, UserStatusOffline
from prettytable import PrettyTable
# Generate API_ID, API_HASH and SHORT_NAME in https://my.telegram.org/apps
API_ID = ''
API_HASH = ''
SHORT_NAME = ''
@membrive
membrive / get-git-branch.py
Created August 4, 2020 08:56
Get the name of the current git branch using git binary and no other Python libraries
#!/usr/bin/env python3
from subprocess import run, PIPE
branch_proc = run(['git', 'branch', '--show-current'],
stdout=PIPE,
universal_newlines=True,
cwd='.') # set CWD to the branch directory
if branch_proc.returncode == 0:

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@membrive
membrive / lambda_sns_to_slack.js
Created January 23, 2019 17:03
Lambda function to send SNS notifications to Slack.
const https = require('https');
const url = require('url');
const slack_url = 'https://hooks.slack.com/services/SET_YOUR_SERVICE_URL'; // set your service URL here
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {
'Content-Type': 'application/json'
};
exports.handler = function(event, context) {
@membrive
membrive / basic_goroutines.go
Created January 20, 2018 09:57
Goroutines example. Use the time command to verify the elapsed time to finish the execution.
// goroutines errors example
package main
import (
"errors"
"fmt"
"time"
)
@membrive
membrive / pcapySniffer.py
Created August 31, 2017 13:51
A very simple python-pcapy example for monitor mode WiFi sniffing
#!/usr/bin/python
#
# A very simple python-pcapy example for monitor mode WiFi sniffing.
#
# Usage example:
# $ python pcapySniffer.py mon0
import pcapy
import sys
import os