Skip to content

Instantly share code, notes, and snippets.

View fernandolopez's full-sized avatar

Fernando López fernandolopez

View GitHub Profile
@fernandolopez
fernandolopez / debconf-selections.txt
Created December 6, 2011 06:30 — forked from josch/debconf-selections.txt
debconf installer preseed
# Services to use:
# Choices: security updates (from security.debian.org), volatile updates (from volatile.debian.org)
apt-setup-udeb apt-setup/services-select multiselect
# Non-existing physical volume
partman-auto-lvm partman-auto-lvm/no_such_pv error
# Check the integrity of another CD-ROM?
d-i cdrom-checker/nextcd boolean false
# Install GRUB?
grub-installer grub-installer/grub_not_mature_on_this_platform boolean false
@fernandolopez
fernandolopez / gist:3768514
Created September 23, 2012 01:53
para mate4
from pylab import *
import cmath
ion()
def zroots(k, z):
roots = []
theta = arctan2(z.imag, z.real)
modroot = abs(z)**(1.0/k)
for i in range(k):
real = modroot * cos(float(theta+2*i*pi)/k)
#!/bin/sh
if [ -n "$RANDOM" ]; then
# Bash
random(){ echo $RANDOM; }
elif which perl; then
random(){ perl -e "print(rand() * (10**15))"; }
elif which openssl; then
random(){ printf "%d" 0x$(openssl rand -hex $(date +%r)); }
else
random(){
@fernandolopez
fernandolopez / run_boxed_dropbox.sh
Last active December 14, 2020 19:50
Boxed Dropbox permite ejecutar al mismo tiempo múltiples instancias de Dropbox asociadas a distintas cuentas.Requiere zenity y dropbox ya instalado en el PATH del sistema (paquete nautilus-dropbox en Debian).Si existe $HOME/Dropbox RENOMBRARLO o BORRARLO de otra manera el script descargará todo dentro del mismo.Uso:- Descargar en el home del usu…
#!/bin/sh
# run_boxed_dropbox.sh permite ejecutar al mismo tiempo múltiples
# instancias de Dropbox asociadas a distintas cuentas.
# Copyright (C) 2013 Fernando López <flopez [at] linti.unlp.edu.ar>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@fernandolopez
fernandolopez / unload_mod.sh
Last active December 14, 2020 19:50
unload_mod.sh unloads the selected linux kernel module and all the other modules that depends on it.
#!/bin/bash
###############################################################################
#
# Copyright 2013 Fernando E. M. López
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@fernandolopez
fernandolopez / rvm_without_sudo.sh
Last active December 14, 2020 19:50
Install RVM without sudo
#!/bin/bash
# Change this:
RUBY_VERSION=1.9.3
echo "su -c apt-get install curl"
while ! su -c apt-get install curl; do
true
done
curl -L https://get.rvm.io | bash -s stable --autolibs=read-fail
if ! grep 'source $HOME/.bash_profile' ~/.bashrc; then
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl libssl-dev \
libreadline5 libreadline5-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
@fernandolopez
fernandolopez / shell.py
Last active December 14, 2020 19:49
Ejemplo muy básico de un shell para ilustrar la diferencia de los comandos internos y comandos externos de los shells usados en sistemas operativos unix-like. El ejemplo no un estilo muy prolijo ni pythonico porque está pensado para ser fácil de entender para personas que no conocen el lenguaje.
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
#
# Ejemplo de un shell extremadamene rudimentario e incompleto
# para ilustrar la diferencia entre comandos internos
# y comandos externos
#
@fernandolopez
fernandolopez / deploy_ruby.sh
Last active December 14, 2020 19:49
Instalación de Ruby 2 con rbenv
#!/bin/bash
if [ ! -d "$HOME/.rbenv" ]; then
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
fi
export PATH="$HOME/.rbenv/bin:$PATH"
#!/bin/sh
# Transformar páginas de didiwiki a markdown
sed -i -r 's/\x00/\n/g' * # Las páginas de didiwiki terminan en \0
sed -i -r 's/\[(\S+)\s(.+)\]/[\2](\1)/g' * # Los links tienen formato distinto
# Los links locales no tienen extensión
sed -i -r 's/(\[.+\]\([^(https?:)].+)\)/\1.md)/g' *
sed -i -r 's/\[([^(https?:)][^]]+)\]\s+$/[\1](\1.md)/g' *