Skip to content

Instantly share code, notes, and snippets.

View pateketrueke's full-sized avatar

Alvaro Cabrera Durán pateketrueke

View GitHub Profile
@pateketrueke
pateketrueke / dl.md
Created February 2, 2018 17:52
Una lista de definiciones, el drama.

Problema

Dada la lista de definiciones de abajo:

<dl>
  <dt>x</dt>
  <dd>a</dd>
  <dd>b</dd>
@pateketrueke
pateketrueke / lvm_apt_get.txt
Created May 9, 2018 22:04
Mount and install through LVM
vgchange -a y
mkdir /newroot
mount /dev/yourVG/rootLV /newroot
mount /dev/yourbootpartition /newroot/boot
mount -o bind /dev /newroot/dev
mount -o bind /sys /newroot/sys
mount -o bind /var /newroot/var
mount -o bind /proc /newroot/proc
@pateketrueke
pateketrueke / env.sh
Created May 18, 2018 20:52
Extract ENV vars from JSON files
#!/bin/bash
set -eu
echo "$( tr '\n' ' ' < vars.json | jq -r 'keys[] as $k | "export \($k)=\"\(.[$k])\""' )"
# usage:
# ./env.sh > .env
#. source .env
# echo "$SOME_ENV_VALUE"
<?php
$start = memory_get_usage(true);
define('INPUT_FILE', $argv[1]);
define('IS_DECODE', array_search('--decode', $argv) !== false);
if (!is_file(INPUT_FILE)) {
echo "Invalid or missing input.\n";
echo "Usage: php extract-xml.php download.xml [--decode]\n";
@pateketrueke
pateketrueke / Hakifile.js
Last active December 4, 2018 03:58
Hakifile.js example
module.exports = haki => {
haki.setGenerator('the:truth', {
description: "Display if it's true, or not",
arguments: ['verb', 'value'],
abortOnFail: true,
actions(input) {
const { verb, value } = input;
if (verb === 'is' && parseInt(value, 10) === 42) {
console.log('Gotcha!');