Skip to content

Instantly share code, notes, and snippets.

View thedarsideofit's full-sized avatar

Diego Alcides Ramirez thedarsideofit

View GitHub Profile
@thedarsideofit
thedarsideofit / gist:f08562558dd87172a28b
Created February 11, 2016 22:32 — forked from nostah/gist:d610459d50564c729c56
php swagger 2.0 api sample
<?php
use Swagger\Annotations as SWG;
/**
* @SWG\Swagger(
* basePath="/v1",
* host="api.local",
* schemes={"http"},
* produces={"application/json"},
@thedarsideofit
thedarsideofit / README.md
Created April 6, 2016 13:57 — forked from debashisbarman/README.md
A Twitter bot that can retweet in response to the tweets matching particluar keyword (https://goo.gl/4whEIt)

#Creating a Twitter bot with Node.js Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)

##Tools we need Here are the tools we’ll be using to create the bot — 

  • Node.js installed in your machine
  • A registered Twitter account

Create a Twitter application

@thedarsideofit
thedarsideofit / Apriori.py
Created September 17, 2017 03:15 — forked from marcelcaraciolo/Apriori.py
Apriori.py
#-*- coding:utf-8 - *-
def load_dataset():
"Load the sample dataset."
return [[1, 3, 4], [2, 3, 5], [1, 2, 3, 5], [2, 5]]
def createC1(dataset):
"Create a list of candidate item sets of size one."
@thedarsideofit
thedarsideofit / ubuntu-node-js
Created December 3, 2017 15:31 — forked from stephanetimmermans/ubuntu-node-js
Install Node.js on Ubuntu 14.10
#https://www.digitalocean.com/community/articles/how-to-install-node-js-on-an-ubuntu-14-04-server
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
npm config set prefix ~/npm
#append to .bashrc
export PATH="$PATH:$HOME/npm/bin"
sudo chown -R `whoami` ~/.npm
@thedarsideofit
thedarsideofit / surprise_tutorial.py
Created December 17, 2017 15:36 — forked from mahermalaeb/surprise_tutorial.py
The easy guide for building python collaborative filtering recommendation system in 2017
import zipfile
from surprise import Reader, Dataset, SVD, evaluate
# Unzip ml-100k.zip
zipfile = zipfile.ZipFile('ml-100k.zip', 'r')
zipfile.extractall()
zipfile.close()
# Read data into an array of strings
with open('./ml-100k/u.data') as f:
@thedarsideofit
thedarsideofit / commands.bash
Created December 17, 2017 15:39
Linux Commands
#Ordenar 5 Directorios que ocupan espacio
#https://blog.desdelinux.net/du-ver-directorios-ocupan-espacio/
du -hs * | sort -nr | head -5
#Rotar logs
#http://helloit.es/2012/08/rotar-archivos-de-log-con-logrotate/
logrotate -vf /etc/logrotate.conf
@thedarsideofit
thedarsideofit / mysql-levenshtein.sql
Created December 29, 2017 16:44 — forked from Kovah/mysql-levenshtein.sql
Levenshtein function for MySQL
-- Levenshtein function
-- Source: https://openquery.com.au/blog/levenshtein-mysql-stored-function
-- Levenshtein reference: http://en.wikipedia.org/wiki/Levenshtein_distance
-- Arjen note: because the levenshtein value is encoded in a byte array, distance cannot exceed 255;
-- thus the maximum string length this implementation can handle is also limited to 255 characters.
DELIMITER $$
DROP FUNCTION IF EXISTS LEVENSHTEIN $$
CREATE FUNCTION LEVENSHTEIN(s1 VARCHAR(255) CHARACTER SET utf8, s2 VARCHAR(255) CHARACTER SET utf8)
@thedarsideofit
thedarsideofit / split.sql
Created December 29, 2017 16:49
Split function in Mysql
--https://stackoverflow.com/questions/5928599/equivalent-of-explode-to-work-with-strings-in-mysql
CREATE FUNCTION SPLIT_STRING(str VARCHAR(255), delim VARCHAR(12), pos INT)
RETURNS VARCHAR(255)
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(str, delim, pos),
LENGTH(SUBSTRING_INDEX(str, delim, pos-1)) + 1),
delim, '');
@thedarsideofit
thedarsideofit / res-reduction-plus-watermark.sh
Last active February 24, 2018 23:35
Image Quality Reduction and Watermark with imagemagick
# move to a main image folder
sudo apt-get install imagemagick
# create a redux folder
mkdir ./redux
for f in *.jpg; do convert $f -quality 80 ./redux/$f;done
# move into redux
cd ./redux
#create watermarked folder
mkdir ./watermarked
#i use a logo.png file placed in main image folder
@thedarsideofit
thedarsideofit / sh
Created April 16, 2018 12:14
export-import-gzip.sh
#https://fuubar.wordpress.com/2015/03/26/importarexportar-base-de-datos-mysql-con-gzip/
mysqldump -u user -p database | gzip > database.sql.gz
gunzip < database.sql.gz | mysql -u user -p database