Skip to content

Instantly share code, notes, and snippets.

View dinigo's full-sized avatar

Daniel Iñigo dinigo

View GitHub Profile
@dinigo
dinigo / context.xml
Last active August 29, 2015 14:01
Patches and config files for a subject
<?xml version='1.0' encoding='utf-8'?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource>
<Resource name="jdbc/tienda" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="tomcat" password="s3cr3t-hsqldb" driverClassName="org.hsqldb.jdbc.JDBCDriver"
url="jdbc:hsqldb:hsql://localhost:11000/tienda"/>
</Context>
@dinigo
dinigo / SelectableArrayListActivity.java
Created May 21, 2014 01:31
ListActivity ready for Context Actionbar multiselect
package es.daniel.notes;
import android.app.ListActivity;
import android.content.Context;
import android.os.Bundle;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
@dinigo
dinigo / colors.xml
Created June 4, 2014 17:19
Colores de Notecard
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--tarjetas-->
<color name="note_shadow">#ffcfc7b8</color>
<color name="note_dark_shadow">#ffada59a</color>
<color name="note_bg">#fffff7e8</color>
<color name="note_highlight">#ffffffff</color>
<color name="underline">#ffefe8d9</color>
<!--separador -->
<color name="separator">#ffe24c46</color>
@dinigo
dinigo / faculty.bat
Created November 19, 2014 10:08
A couple of bat scripts for switching between static and DHCP IP configuration on Windows 8
netsh interface ip set address "Wi-Fi" static 10.38.24.24 255.255.0.0 10.38.0.1 1
netsh interface ip set dnsservers "Wi-Fi" static 156.35.41.4 primary
netsh interface ip add dnsservers "Wi-Fi" addr=156.35.14.2 index=2
@dinigo
dinigo / install_powerline.sh
Created December 6, 2014 16:25
Install powerline and fonts, and set it for the current user on tmux, vim and bash status line.
#!/bin/bash
sudo apt-get install python-pip git -y
sudo pip install git+git://github.com/Lokaltog/powerline
wget https://github.com/Lokaltog/powerline/raw/develop/font/PowerlineSymbols.otf https://github.com/Lokaltog/powerline/raw/develop/font/10-powerline-symbols.conf
sudo mv PowerlineSymbols.otf /usr/share/fonts/
sudo fc-cache -vf
sudo mv 10-powerline-symbols.conf /etc/fonts/conf.d/
# vim status line
@dinigo
dinigo / AmigoInvisible.java
Created December 7, 2014 17:59
Small program to asign partners for "Invisible Friend" events. From a list of names it creates a text file for each containing another one of the list. It ensures no one gets himself asigned.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Random;
@dinigo
dinigo / smb.conf
Created December 14, 2014 17:47
Samba configuration at /etc/samba/
[global]
workgroup = WORKGROUP
server string = %h server (Samba, Ubuntu)
server role = standalone server
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
@dinigo
dinigo / addmediauser.sh
Created January 12, 2015 19:05
Add a user, with a home directory but without shell access, to the Samba and Time Machine services
#!/bin/sh
# Call this script as root like:
# ./addmediauser.sh myusername mypassword
# Password will be shown in plain text (obviously)
# so watch out for shoulder surfers!
USERNAME=$1
PASSWORD=$2
useradd --create-home --groups samba timemachine --shell /bin/false $USERNAME
@dinigo
dinigo / split.py
Last active August 29, 2015 14:21
Split pdf pages wich contains slides so that every page contains just one slide. It only works with two slides per page, either horizontal or vertical.
#!/usr/bin/env python
# Based on http://unix.stackexchange.com/a/12483
# To use it you have to give it execution privilleges
# with the command:
# chmod u+x split.py
# Then you can use it like this:
# ./split.py <slides.pdf >split.pdf
import copy, sys
from pyPdf import PdfFileWriter, PdfFileReader
@dinigo
dinigo / for-loop.asm
Created October 30, 2015 17:30
Collection of usefull assembly loops and functions
;=====================================================;
; This piece of code runs certain times depending on ;
; how many nested loops you create. Each loop can ;
; count up to 255. ;
; We declare a variable for each loop and preload ;
; them with the default value (maxium FFh or 255d ;
; For demonstration purposes we're using just 3 ;
; nested loops executing a total of 845.325 times ;
;=====================================================;