Skip to content

Instantly share code, notes, and snippets.

View nihilismus's full-sized avatar

Antonio Hernández Blas nihilismus

View GitHub Profile
@nihilismus
nihilismus / xrandr-qemu.sh
Created April 7, 2015 01:00
xrandr command for a gnu/linux virtual machine in qemu with -display=gtk
#!/bin/sh
# Based on https://wiki.archlinux.org/index.php/Xrandr#Adding_undetected_resolutions
# For a gnu/linux virtual machine in qemu with -display=gtk
mode="$(cvt 1280 720 | tail -1 | sed 's/Modeline //')"
xrandr --newmode $mode
mode="$(cvt 1280 720 | tail -1 | sed 's/Modeline //' | sed 's/ .*//')"
@nihilismus
nihilismus / 1st-example-of-output.txt
Last active August 29, 2015 14:19
script to search for missing packages using ldd, objdump and slackpkg.
root@slackware-current: cat missing-packages.log
Searching with ldd...
/usr/bin/capinfos [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/capinfos [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/capinfos [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/captype [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/captype [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/dftest [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/dftest [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
/usr/bin/dftest [wireshark-1.12.2-x86_64-1_hba] => libgcrypt.so.11 [?]
#!/bin/sh
# Converts http://www.nirsoft.net/countryip/mx.csv
# into a rules of tcpdump
#
# Copyright © 2015 Antonio Hernández Blas <hba.nihilismus@gmail.com>
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://www.wtfpl.net/ for more details.
(ns prueba.main)
(def alumnos
[{:nombre "A" :numero-de-control "12345" :calificaciones [80 70 80]}
{:nombre "B" :numero-de-control "23456" :calificaciones [90 70 0]}
{:nombre "C" :numero-de-control "34567" :calificaciones [100 70 70]}
{:nombre "D" :numero-de-control "45678" :calificaciones [100 100 90 90 70 70 80 80]}
{:nombre "E" :numero-de-control "56789" :calificaciones [100 70 70]}
{:nombre "F" :numero-de-control "67890" :calificaciones [100 90 100]}
{:nombre "G" :numero-de-control "78901" :calificaciones [100]}
(ns prueba.main)
(def alumnos
[{:nombre "A"
:apellidos {:paterno "AA" :materno "AAA"}
:sexo "m"
:numero-de-control "12345"
:calificaciones [80 70 80]}
{:nombre "B"
:apellidos {:paterno "BB" :materno "BBB"}
(ns plf.core)
(defn isa01
[xs]
(map (fn [x] (/ x 2)) xs))
(defn isa02
[xs]
(map count xs))
@nihilismus
nihilismus / test.php
Created May 31, 2015 03:56
Ejemplo de uso de pgsql y pdo_pgsql
// Módulo pgsql:
<?php
$c_pgsql = pg_connect("host=127.0.0.1 user=alu12345 password=12345 dbname=bd12345 port=1111");
$r_pgsql = pg_query($c_pgsql, "select version()");
$r = pg_fetch_assoc($r_pgsql);
echo $r['version'];
?>
// Módulo pdo_pgsql:
@nihilismus
nihilismus / SF.js
Last active August 29, 2015 14:25
Ordinario 1
var SF = (function() {
/*
* Entrada:
* f1(5, 3)
* Dos números cualesquiera: x e y.
*
* Salida:
* [[5, 15], [3, 9]]
* Dos arreglos anidados con dos elementos: el primero x u y, y el
* segundo su triple.
#!/bin/sh
# Fixes CSV files from DENUE (INEGI), which have some tuples/registers
# splitted in two lines.
#
# Copyright © 2015 Antonio Hernández Blas <hba.nihilismus@gmail.com>
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://www.wtfpl.net/ for more details.
@nihilismus
nihilismus / missing-packages-after-rebuild-mesa.log
Last active August 29, 2015 14:27
Missing packages / Dependencies problems in Slackware -current Fri Aug 21 21:17:48 UTC 2015
Searching with ldd...
/usr/bin/dftest [wireshark-1.12.2-x86_64-1_hba] => libgnutls.so.28 [?]
/usr/bin/dftest [wireshark-1.12.2-x86_64-1_hba] => libnettle.so.4 [?]
/usr/bin/dftest [wireshark-1.12.2-x86_64-1_hba] => libhogweed.so.2 [?]
/usr/bin/ffmpeg [ffmpeg-2.6.3-x86_64_custom-1_hba] => libgnutls.so.28 [?]
/usr/bin/ffplay [ffmpeg-2.6.3-x86_64_custom-1_hba] => libgnutls.so.28 [?]
/usr/bin/ffprobe [ffmpeg-2.6.3-x86_64_custom-1_hba] => libgnutls.so.28 [?]
/usr/bin/ffserver [ffmpeg-2.6.3-x86_64_custom-1_hba] => libgnutls.so.28 [?]
/usr/bin/gtk3-widget-factory [gtk+3-3.16.6-x86_64-1] => libcanberra-gtk3.so.0 [libcanberra-0.30-x86_64-1]
/usr/bin/gtk3-widget-factory [gtk+3-3.16.6-x86_64-1] => libcanberra.so.0 [libcanberra-0.30-x86_64-1]