Skip to content

Instantly share code, notes, and snippets.

View josemmo's full-sized avatar

José Miguel Moreno josemmo

View GitHub Profile
@matti
matti / add.sh
Created July 29, 2017 11:12
alpine docker add package from edge testing
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
x11vnc
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

### hostapd configuration file, loosely based on http://pisarenko.net/blog/2015/02/01/beginners-guide-to-802-dot-11ac-setup/
### for Realtek RTL8812AU via driver https://github.com/abperiasamy/rtl8812AU_8821AU_linux
### and hostap 2.5
### Operates at 135 Mbps in 802.11n/ht mode. iperf measures ~8.00 MBytes/sec 67.1 Mbits/sec
### I was not able to get 802.11ac/vht mode with additional side-channels configured with the driver.
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
interface=wlan2
driver=nl80211
@odan
odan / xampp_php7_xdebug.md
Last active April 17, 2024 05:36
Installing Xdebug for XAMPP
@jamiekurtz
jamiekurtz / grub.cfg
Last active June 8, 2023 00:24
Grub config for creating my own bootable USB stick
# This grub.cfg file was created by Jamie Kurtz
# Detailed instructions for use will soon be found here: http://www.jamiekurtz.com
# Simplified instructions below
# Sample grub entries... https://wiki.archlinux.org/index.php/Multiboot_USB_drive
# Inspiration from here: http://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/
# Simplified instructions...
# Make sure grub, grub-efi, and xorriso packages are installed and up-to-date
# In your terminal go to directory where want to create the USB image contents
# Run the following to create the necessary folder structure:
@larrybolt
larrybolt / cf-ddns.sh
Last active April 29, 2024 13:34
Automatically update your CloudFlare DNS record to the IP, Dynamic DNS for Cloudflare
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# Automatically update your CloudFlare DNS record to the IP, Dynamic DNS
# Can retrieve cloudflare Domain id and list zone's, because, lazy
# Place at:
# /usr/local/bin/cf-ddns.sh
@afgomez
afgomez / validate_spanish_id.js
Last active May 5, 2024 12:31
Spanish DNI, CIF, NIE validator
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );
@brankoajzele
brankoajzele / cerToPem.php
Created January 21, 2013 13:13
Converting .cer to .pem via pure PHP, (no system, backticks, shell_exec, exec, etc.) to get the same result as with "openssl x509 -inform der -in cert.cer -out cert.pem". Note, I am not expert on certificates, etc. This specific certificate conversion simply worked for me.
<?php
$certificateCAcer = '/certificate.cer';
$certificateCAcerContent = file_get_contents($certificateCAcer);
/* Convert .cer to .pem, cURL uses .pem */
$certificateCApemContent = '-----BEGIN CERTIFICATE-----'.PHP_EOL
.chunk_split(base64_encode($certificateCAcerContent), 64, PHP_EOL)
.'-----END CERTIFICATE-----'.PHP_EOL;
@2bard
2bard / translation_notes
Created December 18, 2012 16:29
Using Symfony translation component in Twig outside of Symfony2 framework.
Note: I've left some of the full package names in tact to show exactly where the class comes from.
#### Pull dependencies in using composer ####
//Example composer.json
{
"require": {
"symfony/config" : "2.1.0",
"symfony/yaml" : "2.1.0",
"twig/twig": "1.9.0",
@farhadi
farhadi / rc4.js
Created March 24, 2012 17:09
RC4 encryption in javascript and php
/*
* RC4 symmetric cipher encryption/decryption
*
* @license Public Domain
* @param string key - secret key for encryption/decryption
* @param string str - string to be encrypted/decrypted
* @return string
*/
function rc4(key, str) {
var s = [], j = 0, x, res = '';