Skip to content

Instantly share code, notes, and snippets.

View juancarlospaco's full-sized avatar
👑
https://t.me/NimArgentina

Juan Carlos juancarlospaco

👑
https://t.me/NimArgentina
View GitHub Profile
@juancarlospaco
juancarlospaco / .xonshrc
Last active April 6, 2018 19:26
My xon.sh config.
# Coloured man page support
# using 'less' env vars (format is '\E[<brightness>;<colour>m')
$LESS_TERMCAP_mb = "\033[01;31m" # begin blinking
$LESS_TERMCAP_md = "\033[01;31m" # begin bold
$LESS_TERMCAP_me = "\033[0m" # end mode
$LESS_TERMCAP_so = "\033[01;44;36m" # begin standout-mode (bottom of screen)
$LESS_TERMCAP_se = "\033[0m" # end standout-mode
$LESS_TERMCAP_us = "\033[00;36m" # begin underline
$LESS_TERMCAP_ue = "\033[0m" # end underline
@juancarlospaco
juancarlospaco / 10-my-media-automount.rules
Last active October 17, 2022 15:16
UDev rule that auto mounts any hot-plugged device under /media/<label> and works seamlessly with vfat, ntfs, etc USB storages on Arch Linux. Paste this file and reboot:
# /etc/udev/rules.d/10-my-media-automount.rules
# start at sdb to ignore the system hard drive
KERNEL!="sd[b-z]*", GOTO="my_media_automount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="my_media_automount_end"
# import some useful filesystem info as variables
IMPORT{program}="/sbin/blkid -o udev -p %N"
@juancarlospaco
juancarlospaco / DarkQuassel.css
Last active April 6, 2018 19:24 — forked from Zren/DarkSolarized.qss
Dark Quassel Theme (qss)
/**
** Dark Quassel Theme
**
** - Settings > Configure Quassel > Interface > Client Style.
** - Restart Quassel.
**
*/
/* Window colors */
@juancarlospaco
juancarlospaco / konsole.css
Created October 4, 2016 12:31
Konsole CSS for KDE 5+
QTabBar::tab:selected, QTabBar::tab:hover {
background: qlineargradient(x1: 0 y1: 0, x2: 1 y2: 0, stop: 0 cyan, stop: 1 lightgreen);
color: black;
font: bold italic 20px Oxygen
};
/* Save it, set it as StyleSheet on Settings of Konsole! */
@juancarlospaco
juancarlospaco / cgi-hack.sh
Last active April 6, 2018 19:27
Quick and Dirty CGI Hacks from Bash
mkdir cgi-bin
echo '#!/usr/bin/env python3' > cgi-bin/test.py
echo 'print("Content-type:text/html\n\n"+__import__("calendar").HTMLCalendar().formatyearpage(2017).decode("utf-8"))' >> cgi-bin/test.py
chmod +x cgi-bin/test.py
python3 -m http.server --cgi &
xdg-open http://127.0.0.1:8000/cgi-bin/test.py
@juancarlospaco
juancarlospaco / music8bit.py
Created May 16, 2016 04:56
Crossplatform Sound Playing with StdLib only,No Sound file required. Plays an 8-Bit game style music procedurally generated on the fly.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Crossplatform Sound Playing with StdLib only,No Sound file required.
Plays an 8-Bit game style music procedurally generated on the fly."""
import os
import sys
@juancarlospaco
juancarlospaco / ipdb_on_exception.py
Last active August 15, 2021 14:13
ipdb on Exception AutoMagically!, Launch pdb or ipdb when an exception happens automatically.
def pdb_on_exception(debugger="pdb", limit=100):
"""Install handler attach post-mortem pdb console on an exception."""
pass
def pdb_excepthook(exc_type, exc_val, exc_tb):
traceback.print_tb(exc_tb, limit=limit)
__import__(str(debugger).strip().lower()).post_mortem(exc_tb)
sys.excepthook = pdb_excepthook
@juancarlospaco
juancarlospaco / boilerplate.py-stealth.txt
Last active April 6, 2018 19:34
Boilerplate for any Python3 App, with or without GUI, Standard Lib only, safe, common, basic, trivial, single-file App oriented. Copy at top of your code and use the functions. Includes all imports. I write it after seeing repeating same functions again and again on my code. Designed for Stealth Strings. Not designed for end-user use.
​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
@juancarlospaco
juancarlospaco / template.rst
Last active April 6, 2018 19:31
Universal markup for Markdown and reStructuredText. Template that works with GitHub Markdown AND ReStructuredText at the same time!
@juancarlospaco
juancarlospaco / tinyslation.py
Last active April 6, 2018 19:32
Translate from internet via API from mymemory.translated.net, with Fall-back, DoNotTrack HTTPS, Time-Out and Legally.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tinyslations, smallest possible Translations from Internet with fallback."""
from urllib import parse, request
from locale import getdefaultlocale
from json import loads