Skip to content

Instantly share code, notes, and snippets.

View danielestevez's full-sized avatar
🍁
playing with something, probably

Daniel Estévez danielestevez

🍁
playing with something, probably
View GitHub Profile
@danielestevez
danielestevez / ConstraintTrigger
Created October 15, 2014 09:05
Complex SQL Constraints as a Trigger
CREATE TRIGGER complex_constraint BEFORE INSERT ON my_table
FOR EACH ROW
BEGIN
IF /*complex constraint*/(NEW.field1 IS NOT NULL AND NEW.field2 IS NOT NULL) OR (NEW.field1 IS NULL AND NEW.field2 IS NULL) THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'complex constraint exception message';
END IF;
END
@danielestevez
danielestevez / gist:2215636
Created March 27, 2012 13:09
Useful aliases for bash (bash_aliases)
# .bash_aliases
alias mvi='mvn clean install -Dtest.suite=none -Dit.suite=none -o -fae'
alias psg='ps -ef | grep $1'
alias sk='sudo kill -9 $1'
alias sshi='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
@danielestevez
danielestevez / newgitsubmodulesbranch
Created July 23, 2012 07:48
Create brnaches and push to remote for all GIT submodules
function newbranch() {
git submodule foreach git checkout ${1}
git submodule foreach git pull origin ${1}
git submodule foreach git co -b ${2}
git submodule foreach git push origin ${2}
git status
}
# newbranch master newbranchname
alias mvi='mvn clean install -Dtest.suite=none -Dit.suite=none -fae -T1C'
alias mvall='mvn clean install -Dtest.suite=all -Dit.suite=all -fae -T1C'
alias mvallf='mvan clean install -Dtest.suite=all -Dit.suite=all -ff -T1C'
alias mvndep='mvn cargo:deployer-redeploy'
alias psg='ps -ef | grep $1'
alias sk='sudo kill -9 $1'
alias sshi='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
@danielestevez
danielestevez / debugsql.sql
Last active February 22, 2018 11:51
Utils for debugging triggers and procedures in SQL
DROP TABLE IF EXISTS `kinton`.`debug_msg`;
CREATE TABLE `debug_msg` (
`msg` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
INSERT INTO debug_msg (msg) VALUES (CONCAT('message: ',IFNULL(variable, 'NULL')));
@danielestevez
danielestevez / keybase.md
Created July 23, 2018 18:11
keybase verification

Keybase proof

I hereby claim:

  • I am danielestevez on github.
  • I am destevez (https://keybase.io/destevez) on keybase.
  • I have a public key whose fingerprint is D643 2F6B 354B B8A3 5A62 9875 4A38 23E7 0D46 E466

To claim this, I am signing this object:

@danielestevez
danielestevez / formatsqloutput.sql
Last active April 26, 2019 17:50
Format SQL too many fields
pager less -SFX
select * from table;
* Access JIRA with no SSO, just user/password
https://[JIRA_URL]/jira/secure/Dashboard.jspa?os_username=[USER_NAME]&os_password=[USER_PASSWORD]
@danielestevez
danielestevez / gist:1391076
Created November 24, 2011 10:46
GIT Configurations: Alias to Push/Pull automatically on working branch, nice git log format #git
#include this in your .gitconfigure to perform a pull/push origin on the branch you are currently working
# avoids mistakes performing 'pull origin master' when you are in stable and so on
#
[alias]
# Pushes/pulls to/from remote branch with corresponding name
pl = !git pull origin $(git symbolic-ref HEAD | sed -e 's,.*/\\(.*\\),\\1,')
ps = !git push origin $(git symbolic-ref HEAD | sed -e 's,.*/\\(.*\\),\\1,')
@danielestevez
danielestevez / linux_commands.md
Last active July 14, 2020 22:00
Linux cool commands
  • Kills all process by name

sudo kill -9 $(pidof middleman)