Skip to content

Instantly share code, notes, and snippets.

View dpineiden's full-sized avatar

David Pineda dpineiden

View GitHub Profile
@dpineiden
dpineiden / dop.js
Created December 4, 2019 17:34
Radar chart
var color = d3.scaleOrdinal()
.range(["#EDC951","#CC333F","#00A0B0"]);
var radarChartOptions = {
width: 600,
height: 600,
color: color
};
radarChart = RadarChart()
d3.select('#radarChart')
@dpineiden
dpineiden / quamash_init_pyside2.py
Last active February 27, 2019 19:24
Quamash workin with PySide2
# © 2014 Mark Harviston <mark.harviston@gmail.com>
# © 2014 Arve Knudsen <arve.knudsen@gmail.com>
# BSD License
"""Implementation of the PEP 3156 Event-Loop with Qt."""
__author__ = 'Mark Harviston <mark.harviston@gmail.com>, Arve Knudsen <arve.knudsen@gmail.com>'
__version__ = '0.6.1'
__url__ = 'https://github.com/harvimt/quamash'
__license__ = 'BSD'
__all__ = ['QEventLoop', 'QThreadExecutor']
@dpineiden
dpineiden / inkscape-center.sh
Created February 12, 2019 13:05
Inkscape fit to draw all images
#!/bin/bash
# inkscape-center <file-or-directory>...
# https://graphicdesign.stackexchange.com/questions/22326/how-to-fit-svg-drawings-to-their-canvas-on-the-command-line
_analyse() {
if [ -d "${1}" ] ; then
_centerAll "${1}" ;
else
_center "${1}" ;
fi
@dpineiden
dpineiden / shared_object.py
Created December 31, 2018 15:16
Object declared on a multiprocess manager
import socket
import asyncio
import uvloop
import concurrent.futures
import functools
import sys
from multiprocessing import Manager
from networktools.colorprint import gprint, bprint, rprint
@dpineiden
dpineiden / startapp.sh
Last active January 11, 2019 02:24
Create App for Django with some extras
# OPTIONS >
#
# -n :: app name, obligatory
# -t :: create templates folder {0,1}
# -s :: create static folder {0,1}
# -m :: create media folder {0,1}
# -u :: create urls.py file {0,1}
# -i :: define project name o main folder
#
# how to run?
@dpineiden
dpineiden / spacemacs.lsp
Last active February 13, 2019 13:08
Spacemacs file to work with emacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@dpineiden
dpineiden / choice_input.py
Last active December 10, 2018 13:06
Choice an option from dict
def choice_input(choices_dict,
type_opt_lambda=lambda x: True,
xprint=print):
commands = choices_dict
reverse_commands = {give_name(value): key
for key, value in commands.items()}
options = ["%s -> %s" % (key, give_name(value))
for key, value in commands.items()]
key = ""
msg_type = type_opt_lambda(None)
@dpineiden
dpineiden / wiki.conf
Created August 17, 2018 12:59
HPHP FPM config
; Start a new pool named 'www'.
[wiki]
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
@dpineiden
dpineiden / wiki.conf
Created August 17, 2018 12:58
Nginx for dokuwiki
server {
server_name datawork.csn.uchile.cl;
root /home/wikigps/web;
listen 80;
autoindex off;
client_max_body_size 15M;
client_body_buffer_size 128k;
index index.html index.htm index.php doku.php;
access_log /var/log/nginx/wiki_access.log;
@dpineiden
dpineiden / random_string.py
Created July 26, 2018 13:55
Random String generator
import uuid
import shlex
import simplejson as json
import datetime
import random
def random_char():
"""
Alphabetic uppercase and number 0 to 9 on a random
selection