Skip to content

Instantly share code, notes, and snippets.

@alfchee
alfchee / NumeroALetras.js
Last active Sep 26, 2022
Código en JavaScript que convierte números a letras, bastante útil para formularios de documentos contables y similares
View NumeroALetras.js
/*************************************************************/
// NumeroALetras
// The MIT License (MIT)
//
// Copyright (c) 2015 Luis Alfredo Chee
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
@alfchee
alfchee / git-prune.bash
Created May 3, 2021
Delete all merged branches in remote, excluding branches `dev` and `main`.
View git-prune.bash
git branch --merged | egrep -v "(^\*|main|dev)" | xargs git branch -d
@alfchee
alfchee / debugg_trace.php
Created Oct 26, 2018
Trace the stack of calls for your break var_dump()
View debugg_trace.php
// useful line of code to generate a backtrace
array_walk(debug_backtrace(),create_function('$a,$b','print "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ";')); die();
@alfchee
alfchee / TimelineComponent.js
Created Sep 7, 2018
Idea about time ranges solutions
View TimelineComponent.js
import { Component, OnInit, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
@Component({
selector: 'app-timeline',
templateUrl: './timeline.component.html',
styleUrls: ['./timeline.component.css']
})
export class TimelineComponent implements OnInit {
@alfchee
alfchee / redis-server
Created Jul 16, 2018 — forked from nexdrew/redis-server
Example files for running Redis on CentOS 7 (after manual install)
View redis-server
/var/lib/redis/logs/redis.log {
daily
rotate 14
copytruncate
delaycompress
compress
notifempty
missingok
}
@alfchee
alfchee / simplesaml.conf
Created Jul 14, 2018
Simple SAML PHP configuration, to incluse SimpleSAMLPHP as part of your domain.com/simplesaml
View simplesaml.conf
{
listen 80;
server_name mydomain.com;
location ^~ /simplesaml {
alias /var/simplesamlphp/www;
location ~ ^(?<prefix>/simplesaml)(?<phpfile>.+?\.php)(?<pathinfo>/.*)?$ {
include fastcgi_params;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
@alfchee
alfchee / install_redis_on_ubuntu.md
Created Jun 7, 2018 — forked from torgeir/install_redis_on_ubuntu.md
Redis 2.4.8 Install on Ubuntu 10.04
View install_redis_on_ubuntu.md

Installation commands:

$ wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
$ tar xvfz redis-2.4.8.tar.gz 
$ cd redis-2.4.8/
$ mkdir -p /opt/redis
$ make PREFIX=/opt/redis install
$ cp redis.conf /opt/redis/redis.conf
$ chown -R redis:redis /opt/redis
@alfchee
alfchee / slice_exists.go
Created Apr 26, 2018 — forked from r6m/slice_exists.go
golang check if item exists in slice
View slice_exists.go
package main
import(
"fmt"
"reflect"
)
func main() {
items := []int{1,2,3,4,5,6}
fmt.Println(SliceExists(items, 5)) // returns true
@alfchee
alfchee / remove-unused-branches.sh
Created Nov 27, 2017
This simple script will prune the removed branches on remote, list the branches that has a state of "gone" and then remove them
View remove-unused-branches.sh
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d
@alfchee
alfchee / wkhtmltopdf.sh
Created Jul 7, 2017 — forked from Rajeshr34/wkhtmltopdf.sh
Wkhtmltopdf With Patched QT Setup Ubuntu 16+
View wkhtmltopdf.sh
cd ~
wget https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
mv wkhtmltox/bin/wkhtmlto* /usr/bin
apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig