Skip to content

Instantly share code, notes, and snippets.

View alexandregz's full-sized avatar
🎯
Focusing

Alexandre Espinosa Menor alexandregz

🎯
Focusing
View GitHub Profile
@alexandregz
alexandregz / appify
Created January 16, 2024 01:28 — forked from mathiasbynens/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
# YouTube (english) : https://www.youtube.com/watch?v=FtU2_bBfSgM
# YouTube (french) : https://www.youtube.com/watch?v=VjnaVBnERDU
#
# On your laptop, connect to the Mac instance with SSH (similar to Linux instances)
#
ssh -i <your private key.pem> ec2-user@<your public ip address>
#
# On the Mac
@alexandregz
alexandregz / recreate.sh
Created November 30, 2020 15:05
debian desatendida
#!/bin/sh
# https://www.librebyte.net/despliegue-de-sistemas/como-instalar-debian-de-forma-automatica-o-desatendida/
# a partir de passo 6, umah vez creado o pressed.cfg
chmod +w -R isofiles/install.amd/
gunzip isofiles/install.amd/initrd.gz
echo preseed.cfg | cpio -H newc -o -A -F isofiles/install.amd/initrd
gzip isofiles/install.amd/initrd
chmod -w -R isofiles/install.amd/
@alexandregz
alexandregz / ImageBadgeView
Created August 11, 2020 15:28 — forked from rohanraarora/ImageBadgeView
Image View with a badge on top right corner like notification count in facebook and other apps.
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ImageView;
@alexandregz
alexandregz / .bashrc
Created April 16, 2020 05:46 — forked from admackin/.bashrc
Sane SSH_AUTH_SOCK handling for Screen and Tmux, so that new SSH agents created by subsequent logons are still usable.
_ssh_auth_save() {
ln -sf "$SSH_AUTH_SOCK" "$HOME/.ssh/ssh-auth-sock.$HOSTNAME"
}
alias screen='_ssh_auth_save ; export HOSTNAME=$(hostname) ; screen'
alias tmux='_ssh_auth_save ; export HOSTNAME=$(hostname) ; tmux'
@alexandregz
alexandregz / Local PR test and merge.md
Created February 27, 2020 23:48 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@alexandregz
alexandregz / Local PR test and merge.md
Created February 27, 2020 23:48 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@alexandregz
alexandregz / main.go
Created August 7, 2019 09:57 — forked from ssimunic/main.go
Monitor web page changes with Go
package main
import (
"net/http"
"io/ioutil"
"time"
"log"
"os"
)
@alexandregz
alexandregz / randomator.pl
Created October 11, 2017 07:28 — forked from starenka/randomator.pl
Sets a random message on pidgin start (or plugin acivation). Please place your message file named randomator.txt into ~/.purple/plugins. Each line is a 'status message'
# randomator plugin for Pidgin / libpurple
# @author starenka moc.liamg@0aknerats (backwards) 2008
use Purple;
%PLUGIN_INFO = (
perl_api_version => 2,
name => "randomator",
version => "0.1",
summary => "Sets a random message on pidgin start.",

steps to reproduce:

curl 'http://thequeue.org/cr?id=https%3A%2F%2Faaronsw.jottit.com%2Fhowtoget&title=Aaron%20Swartz:%20howtoget' > how-to-get.html
html2text.py how-to-get.html > how-to-get.md
gist < how-to-get.md

Aaron Swartz: howtoget