Skip to content

Instantly share code, notes, and snippets.

View fespino's full-sized avatar
馃

Francisco Espino fespino

馃
View GitHub Profile
@fespino
fespino / server4spa.py
Created September 13, 2024 10:47 — forked from iktakahiro/server4spa.py
Python3 http.server for Single Page Application
#!/usr/bin/env python
# Inspired by https://gist.github.com/jtangelder/e445e9a7f5e31c220be6
# Python3 http.server for Single Page Application
import urllib.parse
import http.server
import socketserver
import re
from pathlib import Path
@fespino
fespino / aws-mfa.sh
Created September 1, 2021 20:20 — forked from kshcherban/aws-mfa.sh
Simple script to set AWS creds with MFA auth, just put it in your bashrc like `alias mfa='. ~/.local/bin/aws-mfa.sh $@'`
#!/bin/bash
#set -eo pipefail
#
# Sample for getting temp session token from AWS STS
#
# aws --profile youriamuser sts get-session-token --duration 3600 \
# --serial-number arn:aws:iam::012345678901:mfa/user --token-code 012345
#
# 1 or 2 args ok
@fespino
fespino / box-shadow.html
Created July 27, 2020 13:06 — forked from ocean90/box-shadow.html
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@fespino
fespino / hash_array_to_csv.rb
Created April 8, 2019 09:13 — forked from christiangenco/hash_array_to_csv.rb
Ruby hash array to CSV
class Array
def to_csv(csv_filename="hash.csv")
require 'csv'
CSV.open(csv_filename, "wb") do |csv|
csv << first.keys # adds the attributes name on the first line
self.each do |hash|
csv << hash.values
end
end
end
@fespino
fespino / mysql-docker.sh
Created April 15, 2018 13:12 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

Local DevelVM to Work VM to remote Devel0

Habilitar la conexi贸n entre de Toy a Work en FirewallVM

Siendo A DevelVM y B WorkVM.

En FirewallVM:

sudo iptables -I FORWARD 2 -s  -d  -j ACCEPT
[core]
autocrlf = input
excludesfile = ~/.gitignore_global
[user]
name = nobody
email = nobody@example.com
[color]
diff = auto
status = auto
branch = auto
# -*- coding: utf-8 -*-
import kombu
import kombu.mixins
import kombu.common
import transactional.controller
class Worker(kombu.mixins.ConsumerMixin):
def __init__(self, connection, controller, queues):
self.connection = connection
import pika
import pruebas.controller
class BlockingConnectionAdapter(object):
def __init__(self, controller, queue='test'):
self.controller = controller
self.connection = pika.BlockingConnection()
self.channel = self.connection.channel()
self.queue = self.channel.queue_declare(queue=queue, durable=True, exclusive=False, auto_delete=False)