Skip to content

Instantly share code, notes, and snippets.

View alfredoem's full-sized avatar

Alfredo Espiritu alfredoem

  • Lima/Perú
View GitHub Profile
@alfredoem
alfredoem / collection.py
Last active April 18, 2021 00:17
Python Collection Example
listacol = {}
listacol['1111'] = {
'name': 'Greed',
'country_name': 'PERU',
'state': 'Utha'
}
listacol['2222'] = {
'name': 'Cloud',
@alfredoem
alfredoem / openl_primitives_example.cpp
Last active October 30, 2020 21:48
OPENGL primivites example
// rectangle
glColor3f(0.0,0.0,1.0);
glBegin(GL_QUADS);
glVertex2i(7, 4);// arriba derecha - top right
glVertex2i(-7, 4);// arriba izquierda - top left
glVertex2i(-7, 0);// abajo izquierda - bottom left
glVertex2i(7, 0);// abajo derecha - bottom right
glEnd();
// square
try {
File nuevaCarpeta = new File(Environment.getExternalStorageDirectory(), "NombreNuevaCarpeta");
if (!nuevaCarpeta.exists()) {
nuevaCarpeta.mkdir();
}
try {
File file = new File(nuevaCarpeta, "ArchivoDePrueba" + ".txt");
file.createNewFile();
FileOutputStream stream = new FileOutputStream(file);
@alfredoem
alfredoem / GoogleMapsService.java
Created November 18, 2019 15:24
Google Maps Platform test
package com.example;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.maps.GeoApiContext;
import com.google.maps.GeocodingApi;
import com.google.maps.errors.ApiException;
import com.google.maps.model.GeocodingResult;
import java.io.IOException;
@alfredoem
alfredoem / outer-join-mysql.sql
Created May 16, 2019 17:00
Outer Join Mysql
SELECT
u.nombre,
ine.departamento,
ine.provincia,
ine.distrito
FROM mod_ubigeo_departamento AS u
LEFT JOIN ubigeo_inei AS ine ON UPPER(u.nombre) = UPPER(ine.departamento)
WHERE ine.departamento IS NULL
GROUP BY u.nombre
UNION
@alfredoem
alfredoem / Kannel.conf
Created June 21, 2017 23:16
Kannel - Basic Fake configuration file
#---------------------------------------------
group = core
admin-port = 13000
admin-password = test
admin-deny-ip = "*.*.*.*"
admin-allow-ip = "127.0.0.1"
smsbox-port = 13001
box-deny-ip = "*.*.*.*"
box-allow-ip = "127.0.0.1"
dlr-storage = internal
<?php
class HttpRequest
{
protected $host = '';
protected $endpoint = '';
public $url = '';
public $errno = '';
public $error = '';
@alfredoem
alfredoem / NumberShorter.php
Created May 26, 2017 20:00
Reduce length of a number
<?php
namespace Aloha;
class NumberShorten
{
// readable character set excluded (0,O,1,l)
// const CODESET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
const CODESET = "23456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ";
#SELECT list is not in GROUP BY clause and contains nonaggregated column 'db.table.column' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
SET @@sql_mode = "";
@alfredoem
alfredoem / kill-vagrant-proccess.txt
Created April 26, 2017 21:26
An action 'up' was attempted on the machine 'homestead-7', but another process is already executing an action on the machine.
$ ps -ef | grep ruby
$ ps -ef | grep vagrant
$ kill -9
$ Restart "vagrant up --provider=lxc"