Skip to content

Instantly share code, notes, and snippets.

View jjmontesl's full-sized avatar

Jose Juan Montes jjmontesl

View GitHub Profile
@jjmontesl
jjmontesl / webpack.config.js
Created October 31, 2021 02:56 — forked from pglazkov/webpack.config.js
Webpack.config.js for multiple applications
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const apps = [
{
name: 'app1',
baseUrl: '/app1'
},
{
name: 'app2',
@jjmontesl
jjmontesl / bashrc-custom
Created June 28, 2021 10:01
My custom bashrc settings.
# Custom settings (J)
PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;32m\]$(__git_ps1 " (%s)")\[\033[00m\]\$ '
alias grep='grep --color'
alias egrep='grep --color'
alias fgrep='grep --color'
shopt -s histappend
#export PROMPT_COMMAND="$PROMPT_COMMAND ; history -a " # ; history -c ; history -r
@jjmontesl
jjmontesl / parallax-sprite.shader
Created December 19, 2020 21:19
Godot Sprite with Parallax Shader
shader_type canvas_item;
//render_mode unshaded;
uniform float upScale = 1.0f;
uniform float bottomScale = 1.5f;
uniform float clampY = 0.0f;
uniform float expFactor = 0.0f;
void fragment(){
@jjmontesl
jjmontesl / Makefile.godot
Created November 30, 2020 04:24
Makefile for Godot projects
# MyGameProject
# Makefile
APPNAME := MyGameProject
APPNAME_LC := mygameproject
#APPVER := 0.8.2
APPVER := $(shell grep 'string ApplicationVersion' scripts/nc/app/GameApplication.cs | cut -d '"' -f 2 )
#echo $(APPVER)
@jjmontesl
jjmontesl / [django-]http.py
Last active July 9, 2018 20:55
Draft of an integration of Django HTTP on top of Quart-Asyncio.
import logging
import asyncio
from cf.comp.component import Component
from quart import Quart, websocket, app, send_from_directory, redirect, request, url_for
from quart.serving import run_app, Server
from django.core.servers.basehttp import (
WSGIServer, get_internal_wsgi_application, run,
)
@jjmontesl
jjmontesl / gitconfig
Created May 11, 2018 12:38
My .gitconfig
[alias]
ignored = !git ls-files -v | grep "^[[:lower:]]"
ci = commit
st = status .
co = checkout
dc = diff --cached
#lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
mg = merge --no-ff --no-commit
@jjmontesl
jjmontesl / enum_protobuf.py
Created September 12, 2017 14:19
Automatic generation of python Enum from Protobuf enumerations
from enum import Enum, EnumMeta
class ProtobufEnumMeta(EnumMeta):
def __new__(metacls, cls, bases, classdict):
"""
Enum uses its EnumMeta metaclass magic method 'new' to instrument
the Enum class, hence we override that method in order to add
Protobuf attributes from the protobuf enum before.
"""
#!/usr/env/python
import math
from itertools import count, islice
# Running this program shows:
# 1-9 Avg: Primes: 0.4796 bit/symbol (4 items) Composites: 0.7296 bit/symbol (5 items)
# 1-99 Avg: Primes: 0.7795 bit/symbol (25 items) Composites: 0.8763 bit/symbol (74 items)
# 1-999 Avg: Primes: 0.8801 bit/symbol (168 items) Composites: 0.9210 bit/symbol (831 items)
# 1-9999 Avg: Primes: 0.9276 bit/symbol (1229 items) Composites: 0.9403 bit/symbol (8770 items)