Skip to content

Instantly share code, notes, and snippets.

View jthmiranda's full-sized avatar
🎯
Focusing

Jonathan Miranda jthmiranda

🎯
Focusing
View GitHub Profile
@jthmiranda
jthmiranda / hide.sh
Created March 28, 2014 04:07
Hidden Command on Terminal shell
TMP=$(history | tail -1 | awk '{print $1}') && history -d $TMP && 'command to hide'
ps auwx | grep -E '\[.*\]' | grep -v grep | awk '{print $NF}' | awk -F/ '{print $1}' | sed 's/\[//g' | sed s'/\]//g' | sort | uniq | sort
@jthmiranda
jthmiranda / procedimiento.java
Created August 13, 2014 21:32
metodos con el que podes obtener el nombre de los dias y meses -- by miguelsr
public static String getNumDia(String fecha) {
Calendar c = Calendar.getInstance();
try {
SimpleDateFormat sm = new SimpleDateFormat("dd/MM/yyyy");
c.setTime(sm.parse(fecha));
return String.valueOf(c.get(5));
} catch (ParseException ex) {
GenericsUtils.sendExceptionToLogger("sae.pb", ex);
}
return "";
@jthmiranda
jthmiranda / provision
Created September 10, 2014 20:17
provision para agregar una receta y setear configuración de postgresql
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.log_level = "debug"
chef.add_recipe "odoo"
#chef.json = {
# :postgresql => {
# :version => "9.3",
# :listen_address => "*",
# :hba => [
# { :method => "trust", :address => "0.0.0.0/0"},
@jthmiranda
jthmiranda / odoo-server.conf
Created October 13, 2014 19:44
config file for odoo v8
[options]
; This is the password that allows database operations
admin_passwd = admin
db_host = false
db_port = false
db_user = odoo
db_password = false
addons_path=/opt/odoo/v8/other-addons,/opt/odoo/v8/core/addons,/opt/odoo/v8/core/openerp/addons
;logfile = /var/log/odoo/odoo-server.log
xmlrpc_port = 8072
@jthmiranda
jthmiranda / catalina_fragment.sh
Created November 12, 2014 00:03
Setting new relic and passing java ops to use VisualVM
NR_JAR=/usr/share/tomcat/newrelic/newrelic.jar; export NR_JAR
JAVA_OPTS="$JAVA_OPTS -javaagent:$NR_JAR \
-Dcom.sun.management.jmxremote=true \
-Dcom.sun.management.jmxremote.port=9696 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Djava.rmi.server.hostname=[ip]"; export JAVA_OPTS
@jthmiranda
jthmiranda / recover_instance
Created December 17, 2014 17:19
recover access to database openerp after uninstall module has failed
update ir_module_module set state='installed' where='to upgrade'
@jthmiranda
jthmiranda / ejecucion.asm
Created December 17, 2014 19:56
salida en la terminal en mi maquina ubuntu 14.04 x64
(gdb) disassemble
Dump of assembler code for function _start:
0x00000000004000b0 <+0>: mov eax,0x4
0x00000000004000b5 <+5>: mov ebx,0x1
0x00000000004000ba <+10>: mov ecx,0x6000d4
0x00000000004000bf <+15>: mov edx,0x26
0x00000000004000c4 <+20>: int 0x80
0x00000000004000c6 <+22>: mov eax,0x1
=> 0x00000000004000cb <+27>: mov ebx,0x6
0x00000000004000d0 <+32>: int 0x80
@jthmiranda
jthmiranda / Calculadora.java
Created February 14, 2015 04:52
primertarea
package primertarea;
/**
*
* @author Jonathan Miranda
*/
public class Calculadora {
public static int agregar(String nums) {
int total = 0;
@jthmiranda
jthmiranda / docker_mv_dir.sh
Created August 10, 2015 22:02
change docker directory to another partition
turns out you don't need the bind mount. This works with current docker by just modifying the -g option in /etc/docker/defaults DOCKER_OPTS. I had previously tried this and maybe like you failed to get it to work, and looked to linking and bind mounting.
Tried on AWS EC2 VM on a Ubuntu 14.04 server, with a second block storage volume.
First prepare your new block storage, this will house the moved docker folder
First format and mount the new block storage device
mkfs.ext4 /dev/sdx
Mount it
create a mount point
mkdir /mnt/diskX