Skip to content

Instantly share code, notes, and snippets.

View blackymetal's full-sized avatar

Ariel Patino blackymetal

View GitHub Profile
#include <stdio.h>
#include <string.h>
void swap(int *, int *);
main() {
int px, py;
px = 1;
py = 2;
printf("%d %d\n", px, py);
swap(&px, &py);
@blackymetal
blackymetal / e-dice
Last active August 29, 2015 14:01
Arduino Electronic dice
/***************************************************
Author Arianne Patiño and Ariel Patiño
****************************************************/
#include <Wire.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_BicolorMatrix matrix = Adafruit_BicolorMatrix();
@blackymetal
blackymetal / gcc_libwebsockets
Created July 11, 2014 20:01
Compilling with libwebsockets
gcc [parameters] -I/path/to/more/headers [source files] /path/to/libwebsockets.(so|dylib)
gcc -o simple -Ilib/ test-client.c ./libwebsockets.dylib
@blackymetal
blackymetal / blur_effect
Created July 11, 2014 23:29
blur effect with images
body {
background: url(background.jpg);
background-position: center;
background-attachment: fixed;
}
.container {
width: 500px;
height: 300px;
margin: 40px auto;
@blackymetal
blackymetal / compile_udf_mysql_mac
Last active August 29, 2015 14:04
Compiling udf mysql lib on mac
Before make sure ldflag is set to mysqld with:
mysqlbug
gcc -bundle -v -o levenshtein.so levenshtein.c -undefined dynamic_lookup -I/usr/local/mysql/include
#include <stdio.h>
#include <string.h>
int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy);
float buffx[3];
float buffy[3];
main()
{
buffx[0] = 1.0; buffy[0] = 1.0;
@blackymetal
blackymetal / Measure response time with curl
Last active June 22, 2021 09:19
How to measure request/response time with curl
curl -w "@curl-format.txt" -o /dev/null -s http://www.aduanacol.com
@blackymetal
blackymetal / mysqldump to csv
Created September 15, 2014 19:05
Dumps database/table to csv with filters
mysqldump -uroot -T/path/ database table --where="field = 'value"
@blackymetal
blackymetal / watch log
Last active May 24, 2016 16:23
watch the last 15 records in a log file
watch tail -n 15 /usr/local/mysql/data/ArielMac.log
@blackymetal
blackymetal / put_elasticsearch
Created October 20, 2014 23:40
Put data to elasticsearch
private function put($data) {
// Open connection
$ch = curl_init();
$url = 'http://127.0.0.1:9200/colombia/bogota/'.$data['id'];
// Set the url, number of POST vars, POST data
curl_setopt( $ch, CURLOPT_URL, $url );
// curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );