Skip to content

Instantly share code, notes, and snippets.

View filipelenfers's full-sized avatar

Filipe Pais Lenfers filipelenfers

View GitHub Profile
@filipelenfers
filipelenfers / userSettings.json
Created January 5, 2018 13:02
Visual Studo Code / vscode - use bash and run zsh
//I like to use oh-my-zsh so I added it as default terminal on vs code
//First define your default distro for wsl
//run this on cmd.exe
//wslconfig /l
//wslconfig /s Ubuntu
//On user Settings add:
{
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\bash.exe",
@filipelenfers
filipelenfers / installJdkTarGzUbuntu.sh
Last active April 22, 2024 02:02
Install JDK from tar.gz Ubuntu
#Login as root
sudo su
#create jdk directory
mkdir /opt/jdk
#uncompress, change to your file name
tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk
#check if files are there
@filipelenfers
filipelenfers / redis-server
Created March 11, 2015 18:20 — forked from tahajahangir/redis-server
init.d file for redis-server
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis/redis.pid
@filipelenfers
filipelenfers / installJmeter.sh
Last active August 29, 2015 14:16
JMeter Server on CentOS
#Download
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-x64.rpm"
#Install
sudo rpm -Uvh jdk-7u75-linux-x64.rpm
#if you already had the openjdk installed before, you need to add the alternatives to this version of java.
#Check
#java -version
@filipelenfers
filipelenfers / installJdk
Last active August 29, 2015 14:16
Install oracle jdk 7 on Centos 6
#Download
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u75-b13/jdk-7u75-linux-x64.rpm"
#Install
rpm -Uvh jdk-7u75-linux-x64.rpm
#if you already had the openjdk installed before, you need to add the alternatives to this version of java.
#Check
java -version
@filipelenfers
filipelenfers / redisInstall
Last active August 29, 2015 14:16
Install redis on Centos 6
#Download and unzip
wget http://download.redis.io/releases/redis-2.8.19.tar.gz
tar xzvf redis-2.8.19.tar.gz
#Deps to compile and test
sudo yum install gcc tcl
#Compile
cd redis-2.8.19
cd deps
@filipelenfers
filipelenfers / replacesOnVarchar
Last active August 29, 2015 14:04
Regex detect varchar fields replace bad chars
replace in varchars fields
find: ([a-zA-Z0-9_]*)\s*varchar\(\d{2,4}\)
replace: replace(replace(t.$1,'|','-'),'"','¬') $1
date format to YYYY/MM/DD HH:MM:SS
find: ([a-zA-Z0-9_]*)\s+(datetime|timestamp){1}
replace: TO_CHAR(t.$1,'YYYY/MM/DD HH24:MI:SS') $1
clean other types
find: ([a-zA-Z0-9_]*)\s+(integer|bigint){1}
1033edge.com
11mail.com
123.com
123box.net
123india.com
123mail.cl
123qwe.co.uk
150ml.com
15meg4free.com
163.com
@filipelenfers
filipelenfers / VagrantfileMultipleCpus.rb
Last active July 22, 2016 14:20
Vagrant VBox configuration multiple cpus
config.vm.provider :virtualbox do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "1024"] #memory to 1GB
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"] #limit the use of cpu to 50%
vb.customize ["modifyvm", :id, "--ioapic", "on"] #needed to use more cpus
vb.customize ["modifyvm", :id, "--cpus", "2"] #enable 2 cpus for the vm
end
@filipelenfers
filipelenfers / SlickBoneCP.scala
Last active October 18, 2016 07:57
Slick 2.0.0 + BoneCP
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp
import java.util.Date
import scala.slick.driver.MySQLDriver.simple._
//import scala.slick.driver.H2Driver.simple._
//MultipleDB examples, DAL included: https://github.com/slick/slick-examples/blob/2.0.0-M3/src/main/scala/com/typesafe/slick/examples/lifted/MultiDBExample.scala e https://github.com/slick/slick-examples/blob/2.0.0-M3/src/main/scala/com/typesafe/slick/examples/lifted/MultiDBCakeExample.scala