Skip to content

Instantly share code, notes, and snippets.

@libesto
libesto / reset_routing_table.sh
Last active August 25, 2025 11:02 — forked from midwire/reset_routing_table.sh
[Reset routing table on OSX] #osx #devops #networking
#!/usr/bin/env bash
# Reset routing table on OSX
# display current routing table
echo "********** BEFORE ****************************************"
#netstat -r
netstat -nr -f inet
echo "**********************************************************"
for i in {0..4}; do
@libesto
libesto / privoxy
Created August 16, 2025 20:43 — forked from odevodyssey/privoxy
Privoxy Sample Configuration - Forwarding (HTTP and SOCKS) on OpenWrt
# /etc/config/privoxy
# replace username and password with proxy provided credentials
config privoxy 'privoxy'
option confdir '/etc/privoxy'
option logdir '/var/log'
option logfile 'privoxy.log'
list filterfile 'default.filter'
list actionsfile 'match-all.action'
@libesto
libesto / Custom_HTML_Signature_in_Apple_Mail_app.md
Created October 11, 2024 00:15 — forked from icetee/Custom_HTML_Signature_in_Apple_Mail_app.md
Custom Apple Mail HTML signature creation guide
@libesto
libesto / README.md
Created November 10, 2023 14:02 — forked from qdm12/README.md
Wireguard and iptables restrictions for multiple users

Wireguard and iptables restrictions for multiple users

If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.

Assumptions

This should fit most setups (not mine though 😉)

@libesto
libesto / GoogleDriveServiceProvider.php
Created March 28, 2023 07:57 — forked from sergomet/GoogleDriveServiceProvider.php
Setup a Laravel Storage driver with Google Drive API
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class GoogleDriveServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
@libesto
libesto / multiple-ssh-keys-git.adoc
Created December 9, 2022 12:18 — forked from alejandro-martin/multiple-ssh-keys-git.adoc
Configure multiple SSH Keys for Git

Use Multiple SSH Keys for Git host websites (Github, Gitlab)

This is guide about how to configure multiple SSH keys for some Git host websites such as Github, Gitlab, among others.

Creating SSH keys

  1. Create SSH directory:

@libesto
libesto / console.save.js
Created January 27, 2022 17:04 — forked from raecoo/console.save.js
Save JSON object to file in Chrome Devtool
// e.g. console.save({hello: 'world'})
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)
@libesto
libesto / ID.js
Created March 2, 2021 18:19
ID - a unique ID/name generator for JavaScript
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`

PHP API to return table names from a given SQL statement with multiple tables

Input

 $query = "SELECT `main_categories`.*, `categories_views`.`view` AS view_ctg, (SELECT COUNT(id_geo) FROM main_geo WHERE id_geo=geo_filter_ctg AND FIND_IN_SET('PK', `countries_geo` )) as countryCount
 FROM (`main_categories`)
 JOIN `categories_parents` ON `main_categories`.`id_ctg` = `categories_parents`.`id_ctg`
 JOIN `categories_views` ON `main_categories`.`id_ctg` = `categories_views`.`id_ctg`

WHERE categories_parents.parent_ctg = '8701'

@libesto
libesto / isElementInViewport.js
Created January 26, 2021 15:07 — forked from davidtheclark/isElementInViewport.js
JavaScript: Is element in viewport?
/*
No jQuery necessary.
Thanks to Dan's StackOverflow answer for this:
http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport
*/
function isElementInViewport(el) {
var rect = el.getBoundingClientRect();
return (
rect.top >= 0 &&