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 / app.desktop
Created June 12, 2013 21:23
Create a app laucher on Unity enviroment
[Desktop Entry]
Name=Napster
Comment=p2p
Exec=/home/user/Documentos/app-1-1-bin-32/appname
Icon=/home/user/Documentos/app-1-1-bin-32/icons/logo.xpm
Terminal=false
Type=Application
#Name: application name
#Comment: comment
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@jthmiranda
jthmiranda / sublime_desktop.app
Created June 25, 2013 18:26
Lanzador de sublime en Unity
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Sublime Text 2
GenericName=Text Editor
Comment=Sophisticated text editor for code, html and prose
Exec=/usr/bin/sublime-text-2 %F
Terminal=false
Type=Application
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;x-directory/normal;inode/directory;
@jthmiranda
jthmiranda / openerp-server.sh
Created June 25, 2013 22:12
Install this script which will be used to start-up and shut down the server automatically and also run the application as the correct use.
#!/bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@jthmiranda
jthmiranda / gitconfig
Created August 3, 2013 17:34
git -- adding color highligth on linux terminal
[alias]
co = checkout
st = status
ci = commit
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
[color]
diff = auto
status = auto
branch = auto
@jthmiranda
jthmiranda / xml.java
Created August 9, 2013 23:02
procedure to obtain an xml attribute from webserver
URL url = new URL("http://pastebin.com/raw.php?i=RF8cL5YZ");
InputSource origin = new InputSource(url.openStream());
XPath path = XPathFactory.newInstance().newXPath();
String exp = "/a/b/c";
Node nodo = (Node) path.evaluate(exp, origin, XPathConstants.NODE);
NamedNodeMap attrs = nodo.getAttributes();
String atrib = attrs.getNamedItem("id").getNodeValue();
System.out.println(atrib);
<!-- Opening task when double clicking on project -->
<record id="dblc_proj" model="ir.actions.act_window">
<field name="res_model">project.task</field>
<field name="name">Project's tasks</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph,gantt,kanban</field>
<field name="domain">[('project_id', 'child_of', [active_id])]</field>
<field name="context">{'project_id':active_id, 'active_test':False}</field>
</record>
<!DOCTYPE html>
<html>
<head>
<script src="http://extjs.cachefly.net/ext-4.1.1-gpl/ext-all-debug.js"></script>
<link rel="stylesheet" href="http://extjs.cachefly.net/ext-4.1.1-gpl/resources/css/ext-all.css">
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
@jthmiranda
jthmiranda / owner.py
Created September 7, 2013 23:44
Get the owner of the file
import win32api
import win32con
import win32security
FILENAME = "temp.txt"
open (FILENAME, "w").close ()
print "I am", win32api.GetUserNameEx (win32con.NameSamCompatible)
sd = win32security.GetFileSecurity (FILENAME, win32security.OWNER_SECURITY_INFORMATION)
@jthmiranda
jthmiranda / move.sh
Last active September 14, 2015 21:14
Moving throught SSH
# to move file or folders
tar zcf - filename | ssh user@ipaddress "cd /; tar xvzf"
# to move docker images to another host
docker save image-name | bzip2 | pv | ssh user@host "bunzip2 | docker load"
# using docker machine (testing yet)
docker $(docker-machine config mach1) save <image> | docker $(docker-machine config mach2) load
# send local file to container (just need to modify through host to host)