Skip to content

Instantly share code, notes, and snippets.

@ivancp
ivancp / .bashrc
Created May 23, 2020 18:30
.bashrc custom scripts
#ivancp custom scripts
export MYSQLSH_PROMPT_THEME=/usr/share/mysqlsh/prompt/prompt_256pl+aw.json
@ivancp
ivancp / rotate.js
Created May 19, 2020 18:20
String.prototype.rotate from @js_tut challenge
/* https://twitter.com/js_tut/status/1262754711502942213 */
String.prototype.rotate = function(shiftVal){
var str = this.toLowerCase();
var newPos = shiftVal > 0 ? (str.length - (shiftVal % str.length)):(Math.abs(shiftVal) % str.length);
if(newPos == str.length)
return str.charAt(0).toUpperCase() + (str.length > 1 ? str.substring(1,str.length):'');
return str.charAt(newPos).toUpperCase() + str.substring(newPos+1,str.length) + str.substring(0,newPos);
}
-- http://bugs.mysql.com/bug.php?id=72838
use test;
DELIMITER $$
DROP PROCEDURE IF EXISTS sp_test$$
CREATE PROCEDURE `sp_test`(p_query varchar(250))
BEGIN
'Put this function in new/existing MS-Access module.
'
' Version History:
' 2012-03-16 - First version http://en.latindevelopers.com/ivancp/2012/ms-access-to-mysql-with-relationships/
'
' 2014-02-09 - Seamus Casey
' a modification to Ivan's handy Access to MySQL relationship/constraint generator
'
' changes include:
' 1) skip Access system tables (TableDefAttributeEnum.dbSystemObjec)
@ivancp
ivancp / .vimrc
Last active August 29, 2015 13:57
My .vimrc file
"Habilitar el resaltado de la sintaxis
syntax enable
"Para que los tabs no ocupen mucho espacio
set shiftwidth=4
set tabstop=4
"Si estamos usando gVIM entonces cambiamos el
"esquema de colores (no me agrada el fondo blanco)
if has("gui_running")
@ivancp
ivancp / repair-output
Last active August 29, 2015 13:57
What happens when repair a 2Gb MyISAM table
mysql> repair table dbdemo.table;
+---------------+--------+----------+-------------------------------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+---------------+--------+----------+-------------------------------------------------------------------+
| dbdemo.table | repair | info | Key 1 - Found wrong stored record at 381432048 |
| dbdemo.table | repair | info | Key 1 - Found wrong stored record at 390303976 |
| dbdemo.table | repair | info | Wrong aligned block at 391242113 |
| dbdemo.table | repair | info | Delete link points outside datafile at 391242113 |
| dbdemo.table | repair | info | Key 1 - Found wrong stored record at 393273584 |
| dbdemo.table | repair | info | Key 1 - Found wrong stored record at 396046628 |
@ivancp
ivancp / gist:4646062
Created January 27, 2013 03:16
Nilcer, usa este programa como plantilla, por que te vas a demorar en hacer el programa para que reciba el input
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <map>
using namespace std;
int main(int argc, char** argv)
{
char* line = new char[501];