Skip to content

Instantly share code, notes, and snippets.

@xezpeleta
xezpeleta / bash-on-windows.ps1
Last active December 1, 2016 15:13
Bash on Windows powershell script (work in progress)
# =====================================================================
# Bash on Windows installator
# @author: Xabi Ezpeleta <[email protected]>
# References:
# - https://msdn.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development#use-group-policies-or-registry-keys-to-enable-a-device
# - https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
# =====================================================================
# Enable Developer Mode
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"

Keybase proof

I hereby claim:

  • I am xezpeleta on github.
  • I am xezpeleta (https://keybase.io/xezpeleta) on keybase.
  • I have a public key whose fingerprint is D700 BAE6 3388 E984 9736 D5E9 5587 BA86 CB39 64F9

To claim this, I am signing this object:

@xezpeleta
xezpeleta / gist:93abfabfc2e9163202b50b2f4cb728ff
Created May 30, 2017 10:16 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
#!/bin/bash
set -e
# Source debconf library.
. /usr/share/debconf/confmodule
dbhost=`sed -n 's/^[ \t]*database_host:[ \t]*\([^ #\t]*\).*/\1/p' /etc/elkarbackup/parameters.yml`
dbname=`sed -n 's/^[ \t]*database_name:[ \t]*\([^ #\t]*\).*/\1/p' /etc/elkarbackup/parameters.yml`
dbusername=`sed -n 's/^[ \t]*database_user:[ \t]*\([^ #\t]*\).*/\1/p' /etc/elkarbackup/parameters.yml`
dbuserpassword=`sed -n 's/^[ \t]*database_password:[ \t]*\([^ #\t]*\).*/\1/p' /etc/elkarbackup/parameters.yml`
@xezpeleta
xezpeleta / sleep-visualizer.R
Created June 14, 2018 18:23
R and Shiny, linked selectInputs
library(shiny)
# Just to use msleep dataset
library(ggplot2)
# Remove NAs
msleep = msleep[complete.cases(msleep), ]
ui <- fluidPage(
sidebarLayout(
@xezpeleta
xezpeleta / LICENSE
Created June 17, 2018 12:14 — forked from mepcotterell/LICENSE
Simple Python Plugin Manager
The MIT License (MIT)
Copyright (c) 2013 Michael E. Cotterell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@xezpeleta
xezpeleta / opeenssl_certificates.md
Last active November 7, 2018 10:22
Certs cheatsheet

Check certificate details

openssl x509 -in ca.crt -noout -text

Check certificate expiration date

openssl x509 -in ca.crt -noout -enddate
@xezpeleta
xezpeleta / tomcat_recovery.sh
Created December 13, 2018 08:04
Tomcat auto-recovery
#! /bin/bash
URL=http://localhost
LOGFILE=/root/scripts/mywebapp_recovery.log
TIMEOUT=5
response=`curl -m $TIMEOUT -s -o /dev/null -w "%{http_code}" $URL`
if [[ "$response" != 200 ]];then
printf '[%(%d/%b/%Y:%H:%M:%S %z)T] Response code: %s\n' -1 "$response" >> $LOGFILE
# Shutdown Tomcat
@xezpeleta
xezpeleta / README.md
Last active January 26, 2024 16:40
Video stabilization with Dockerized FFMPEG
#
# ffmpeg shipped with Ubuntu 18.04 doesn't have libvidstab enabled
# That's why I'm using a dockerized ffmpeg
#

docker run -it -v $(pwd):/tmp jrottenberg/ffmpeg -i /tmp/myvideo.mp4 -vf vidstabdetect=shakiness=5:show=1 /tmp/dummy.mp4
docker run -it -v $(pwd):/tmp jrottenberg/ffmpeg -i /tmp/myvideo.mp4 -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 /tmp/stabilized-output.mp4
@xezpeleta
xezpeleta / edgerouter_dns.md
Created January 22, 2019 12:11
Dynamic DNS on the Ubiquiti EdgeRouter X

Ubiquiti EdgeRouter X: custom dynamic DNS

ssh ubnt@<your-ip>
configure

Obtain your public IP address behind a NAT: using ipinfo.io