Skip to content

Instantly share code, notes, and snippets.

View corbolais's full-sized avatar
🎯
Focusing

Corbo corbolais

🎯
Focusing
View GitHub Profile
@corbolais
corbolais / ES5 class.js
Created October 5, 2021 20:12 — forked from apal21/ES5 class.js
Example for blog to show the difference between ES5 and ES6 javascript classes using inheritance and prototypes use cases.
'use strict';
/**
* Person class.
*
* @constructor
* @param {String} name - name of a person.
* @param {Number} age - age of a person.
* @param {String} gender - gender of a person.
*/
@corbolais
corbolais / selenium-php-webdriver-cheatsheet.md
Created January 14, 2021 22:37 — forked from aczietlow/selenium-php-webdriver-cheatsheet.md
Cheat sheet for using php webdriver (facebook/webdriver).

Webdriver PHP API workthough

  • Open a browser

    # start an instance of firefox with selenium-webdriver
    
    $browser_type = 'firefox'
    $host = 'http://localhost:4444/wd/hub'
    

$capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => $browser_type);

@corbolais
corbolais / delete-missing-images.php
Created May 25, 2020 15:14 — forked from bryanwillis/delete-missing-images.php
delete image references to the wordpress database when they have been deleted from from the uploads folder and not from the admin interface
<?php
// Only run the code if we are in the admin
if ( is_admin() ) :
class WordPressdeleteMissingImages {
// Action/Filter Hooks
function __construct() {
add_action( 'admin_menu', array( &$this, 'add_page' ) );
@corbolais
corbolais / 01nginx-tls-sni.md
Created May 5, 2020 21:45 — forked from kekru/01nginx-tls-sni.md
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@corbolais
corbolais / ansible_conditionals_examples.yaml
Created April 23, 2020 23:10 — forked from marcusphi/ansible_conditionals_examples.yaml
Ansible 1.3 Conditional Execution -- Very complete example with comments -- I find the conditional expressions to be ridiculously hard to get right in Ansible. I don't have a good model of what's going on under the surface so I often get it wrong. What makes it even harder is that there has been at least three different variants over the course …
---
# This has been tested with ansible 1.3 with these commands:
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=false"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts isFirstRun=true"
# ansible-playbook -i hosts ansible_conditionals_examples.yaml --extra-vars="hosts=myhosts"
# NB: The type of the variable is crucial!
- name: Ansible Conditionals Examples
hosts: $hosts
vars_files:
@corbolais
corbolais / test_sudo_and_variables.yml
Last active March 18, 2020 11:00 — forked from ramondelafuente/test_sudo_and_variables.yml
Testing ansible "ansible_ssh_user" and "ansible_user_id" variables with sudo
- name: Testing variables with SUDO=NO
hosts: "*"
become: no
tasks:
- name: "PLAYBOOK SUDO=NO, TASK SUDO=NO"
command: whoami
register: whoami_output
become: no
- debug: var=whoami_output.stdout
@corbolais
corbolais / wan_bachup_via_lte.sh
Created April 20, 2019 13:31 — forked from ssinyagin/wan_bachup_via_lte.sh
WAN backup routing via LTE
### WAN backup routing via LTE ###
# A Linux device, such as PC Engines APU, can be equipped with an LTE modem, but
# sometimes it's desirable to use the mobile connection only if the wired
# connection is unavailable.
# The following scenario is for Debian 9 on an APU box, but it's also
# applicable to any other Linux device.
# The DHCP client is tweaked to ignore the DNS server addresses that are
@corbolais
corbolais / on-modify.timetrack.py
Created October 29, 2018 00:22 — forked from wbsch/on-modify.timetrack.py
Time tracking hook script for Taskwarrior that outputs ledger timelog formatted data.
#!/usr/bin/env python
#
# Writes task start/stop times to a timelog formatted file.
# You might need to adjust LEDGERFILE, or set the TIMELOG environment variable.
#
# Example reports, after using start/stop on a task:
# ledger -f /path/to/timelog.ledger print
# ledger -f /path/to/timelog.ledger register
#
# Projects, tags, and UUIDs are fully supported and queryable from ledger.
@corbolais
corbolais / README.md
Created October 16, 2018 21:25 — forked from miguelmota/README.md
Multiple accounts with Mutt E-Mail Client (gmail example)

How to set up multiple accounts with Mutt E-mail Client

Thanks to this article by Christoph Berg

Instructions

Directories and files

~/
@corbolais
corbolais / annexgetfile.py
Created September 25, 2018 23:00 — forked from eruffaldi/annexgetfile.py
Access to files in git-annex bare repository without using git-annex.
#
# Extract files from Bare git-annex repositories without git-annex
# Supports version v6
#
# See internals: http://git-annex.branchable.com/internals/
#
# Modified: added non-bare repos, added tar file (of symlinks) output for use with archivemount
#
# TODO: improve output
# TODO: use cat-files instead of archive