This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const net = require('net'); | |
const fs = require('fs'); | |
const os = require('os'); | |
const path = require('path'); | |
const process = require('process'); | |
const PORT = 8888; | |
const LOGS_PATH = path.join(os.tmpdir(), 'server.log'); | |
const server = net.createServer((socket) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Inspired on https://sharats.me/posts/shell-script-best-practices/ | |
set -o errexit # if something fails, the script will halt | |
set -o nounset # if an unset variable is being read, the script will halt | |
set -o pipefail # if a command in a pipe fails, the script will halt | |
# Do we want to debug this script? | |
if [[ "${TRACE-0}" == "1" ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "params: [version] (8.0, 5.6, 7.4 ...)" | |
exit 1 | |
fi | |
COMMAND_EXISTS=`which php$1` | |
if [ $? -eq 0 ]; then | |
# editing nginx vhosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/** | |
* This script crafts a magic packet for an Xbox One to boot up from the network. | |
* This has been tested on an Xbox One X in a sleeping state, | |
* it might not work if the console is totally powered off. | |
* No dependencies needed, just copy the script and off you go. | |
* You're free to use this as you wish, but consider mentioning me in your project's credits :) | |
* | |
* Example usage: ./xboxwol.js --ip=192.168.254.100 --liveid=F12345ABCDE12ABX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Programa para determinar la letra de tu DNI | |
* (C) 2019 Arnau Martín | |
*/ | |
const readline = require('readline'); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Object and Array cloning system | |
* =============================== | |
* This basically deep clones an object and/or an array depending on its value and type. | |
*/ | |
// clone an array | |
function arrayClone(source) { | |
let target = []; | |
source.forEach((val, idx) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Simple slack messager for AWS Lambda | |
// I use it on my code to warn me if there's any runtime error. | |
const request = require("request"); | |
const settings = require('./config.json'); | |
exports.handler = (event, context, callback) => { | |
const options = { | |
method: 'POST', | |
url: settings.slack_webhook, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] == 443) { | |
return true; | |
} else { | |
die("Unsafe connections are not allowed!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Pre Prettify</title> | |
<script src="script.js"></script> | |
<link rel="stylesheet" type="text/css" href="style.css"> | |
</head> | |
<body> |