Skip to content

Instantly share code, notes, and snippets.

View virtualadrian's full-sized avatar
🤓
Geek: A knowledgeable and obsessive enthusiast.

VirtualAdrian virtualadrian

🤓
Geek: A knowledgeable and obsessive enthusiast.
View GitHub Profile
sudo -i
apt-get update
apt-get install \
apache2-dev \
autoconf \
automake \
build-essential \
bzip2 \
@virtualadrian
virtualadrian / letsencrypt_2017.md
Created June 3, 2017 06:14 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

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

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@virtualadrian
virtualadrian / secure_sierra.sh
Created June 11, 2017 15:53 — forked from midwire/secure_sierra.sh
Disable bunch of #$!@ in Sierra
#!/bin/bash
# This is a draft but it works
# FIRST (I don't even know if it works but we'll assume yes)
# sudo launchctl list
# sudo launchctl disable system/netbiosd
# sudo launchctl disable system/parsecd
# sudo launchctl disable system/parentalcontrols.check
# sudo launchctl disable system/airportd
@virtualadrian
virtualadrian / App.java
Created June 21, 2017 01:57 — forked from thomasdarimont/App.java
Secure REST API Example with Spring Security, Spring Session, Spring Boot
package demo;
import java.io.Serializable;
import java.security.Principal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
###############################################################################################
# LAMP setup for Ubuntu 16.04 Server #
# Apache + PHP + Percona #
###############################################################################################
# Update and prepare server
apt update; apt -y upgrade
apt -y install nano sudo curl wget git dnsutils lynx
sudo hostname srv.zdb.bz
sudo service hostname start
@virtualadrian
virtualadrian / time_tracker.sh
Created July 26, 2017 21:13 — forked from buger/time_tracker.sh
Bash time tracker
active_time() {
# Query display logs
logs=$(/usr/bin/pmset -g log | grep 'Display is turned')
# By default Mac turn off monitor after 15 minutes
timeout=900
# Read logs line by line
# Line format: 2016-07-12 07:50:02 +0300 Notification Display is turned on
echo "$logs" | while IFS= read -r line; do
d=$(echo $line | cut -c 1-19); # extract full date
@virtualadrian
virtualadrian / gmaps.js
Created August 1, 2017 00:03 — forked from cvan/gmaps.js
Google Maps multiple destinations sorted by shortest path
require('es6-promise').polyfill();
var request = require('request');
const API_KEY = process.env.GOOGLE_MAPS_API_KEY || '';
var places = [
'steins, mountain view, CA',
'st. stephens green, mountain view, CA',
#!/bin/bash
apt-get update
apt-get install -y \
bison \
autoconf \
build-essential \
pkg-config \
git-core \
@virtualadrian
virtualadrian / install.sh
Created August 20, 2017 09:23 — forked from rodrigoslayertech/install.sh
Open LiteSpeed One Click Installation for non-root users v1.0
#!/bin/bash
##############################################################################
# Open LiteSpeed is an open source HTTP server. #
# Copyright (C) 2013 - 2017 LiteSpeed Technologies, Inc. #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
@virtualadrian
virtualadrian / install.sh
Created August 20, 2017 09:23 — forked from rodrigoslayertech/install.sh
Open LiteSpeed One Click Installation for non-root users v1.0
#!/bin/bash
##############################################################################
# Open LiteSpeed is an open source HTTP server. #
# Copyright (C) 2013 - 2017 LiteSpeed Technologies, Inc. #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #