Skip to content

Instantly share code, notes, and snippets.

View cyraxjoe's full-sized avatar

Joel Rivera cyraxjoe

View GitHub Profile
@cyraxjoe
cyraxjoe / pyproject.toml
Created July 8, 2022 08:02
poetry issue with pypi
[tool.poetry]
name = "sample"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
beautifulsoup4 = "^4.11.1"
@cyraxjoe
cyraxjoe / nimlsp.el
Created November 28, 2019 06:53
Hook nim-mode into lsp-mode.
;; hook nim-mode into lsp
(add-to-list 'lsp-language-id-configuration '(nim-mode . "nim"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "nimlsp")
:major-modes '(nim-mode)
:server-id 'nimlsp))
(add-hook 'nim-mode-hook #'lsp)
#!/usr/bin/env bash
#
# Descarga el zip con los certificados raiz del SAT de:
# http://omawww.sat.gob.mx/informacion_fiscal/factura_electronica/Paginas/certificado_sello_digital.aspx
#
# Para usar el script ponlo en la raiz del directorio extraido de Cert_Prod.zip.
#
# Ejecuta con:
# bash ./create-hashes.sh <TARGET-DIR>
#
@cyraxjoe
cyraxjoe / lines_in_code.py
Last active February 19, 2018 19:56
Lines in code demo for potential use un flake8 plugin
import ast
func_code = """
def test():
foo = 1
bar = 2
return foo + bar
"""
tree = ast.parse(func_code)

Keybase proof

I hereby claim:

  • I am cyraxjoe on github.
  • I am cyraxjoe (https://keybase.io/cyraxjoe) on keybase.
  • I have a public key ASBk1dRF0gdkIcVFORqKWwSqxVUZKBge92AgSFRPqNwwfAo

To claim this, I am signing this object:

from __future__ import print_function
class BaseA(object):
def __init__(self):
self.a = "A"
class BaseB(object):
@cyraxjoe
cyraxjoe / cp_execute_in_main_thread.py
Created March 12, 2016 02:40
Execute a callable on the MainThread from a CherryPy application.
import threading
import functools
import cherrypy as cp
class MainExecutor:
"""Wrap a callable to ensure that the execution takes place on the
MainThread based on the cherrypy.engine and the 'main' channel.
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../paper-item/paper-item.html">
import sys
import socket
def client(*bparams):
s = socket.socket()
s.connect(bparams)
return s
def server(*bparams):
s = socket.socket()
@cyraxjoe
cyraxjoe / cp_multiview_demo.py
Last active December 10, 2015 01:34
Sample code to implement multiple views/handlers depending on the Accept and Content-Type headers.
from contextlib import contextmanager
import cherrypy
from cherrypy.lib import cptools
class View(object):
__mime__ = 'text/html'
def __init__(self, controller):