Skip to content

Instantly share code, notes, and snippets.

View alexlopes's full-sized avatar
🏠
Working from home

Alex Lopes alexlopes

🏠
Working from home
View GitHub Profile
@alexlopes
alexlopes / oracle_plsql.md
Created July 30, 2018 17:52
Oracle PLSQL Tricks

Sleep for PLSQL

DECLARE
                      IN_TIME INT := 60;
                      V_NOW DATE;
                    BEGIN
                      DBMS_OUTPUT.PUT_LINE(''START: '' || to_char(SYSDATE, ''YYYY-MM-DD HH24:MI:SS''));

 SELECT SYSDATE 
@alexlopes
alexlopes / maven_tricks.md
Last active July 24, 2018 21:27
Maven Trick

Skip javadoc and tests for Maven Release

mvn -X -Darguments="-Dmaven.javadoc.skip=true -Dmaven.test.skipTests=true -Dmaven.test.skip=true" -P release-mode release:prepare

https://dzone.com/articles/configuring-the-maven-release-plugin-to-skip-tests`

If you would like to avoid executing tests in the Prepare phase, then you need to run it like so:

mvn -DpreparationGoals=clean release:prepare

@alexlopes
alexlopes / javascript.md
Last active June 21, 2018 21:35
JavaScript Tricks - alexlopes

Iterate over "[a,b,c]"

	$("#selector_one").find("input:checkbox[name=mycheckboxes]").each(function(){
		var current_component = $(this)
		$("#selector_two").val().replace(/[\[\]']+/g,'').split(',').forEach(function (item) {
			if (item == current_component.val().toLocaleLowerCase()) {
				$(current_component).prop('checked', true);
			}
 });	
@alexlopes
alexlopes / spring_tricks.md
Last active June 15, 2018 17:34
Spring Tricks

Run

package something;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@alexlopes
alexlopes / linux_tricks.md
Last active March 6, 2024 15:15
Linux Tricks

Remove file with find asking confirmation

find . -iname "file.extension"  -exec rm -i {} \;

Remove/reduce git history packs

# https://help.github.com/articles/removing-sensitive-data-from-a-repository/

Slack Notification for ASUS phone

@alexlopes
alexlopes / python_2.7.9_suds_unverified.patch
Created February 28, 2018 18:50 — forked from quasarj/python_2.7.9_suds_unverified.patch
Patch to allow SUDS to work with invalid (or self-signed) SSL certs, on python 2.7.9+
--- /usr/lib/python2.7/site-packages/suds/transport/http.py 2015-06-09 17:40:15.000000000 -0500
+++ http.py 2015-06-09 17:42:05.953929465 -0500
@@ -19,6 +19,7 @@
"""
import urllib2 as u2
+import ssl
import base64
import socket
from suds.transport import *
@alexlopes
alexlopes / python_tricks.md
Last active December 31, 2018 13:16
Python Tricks

Setup

Installing pip in-line

sudo curl -s  https://bootstrap.pypa.io/get-pip.py  | sudo  python - 'pip<10'

Code Inspect

@alexlopes
alexlopes / python.md
Created October 16, 2017 13:11
Python Trickts

Transiente property for Django Model

class MyModel(models.Model):

created = models.DateTimeField(auto_now_add=True)

...

def _get_children_properties(self):
    return self._children_properties
@alexlopes
alexlopes / ansible_api_playbook.py
Created September 8, 2017 22:07 — forked from viper233/ansible_api_playbook.py
Example using Ansible API 2.0 to run a playbook
#!/usr/bin/env python
# stolen from http://stackoverflow.com/questions/27590039/running-ansible-playbook-using-python-api
import os
import sys
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible.vars import VariableManager
from ansible.inventory import Inventory