This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# client ----> 1.1.1.1 --------> 2.2.2.2 | |
# (relay) (dest) | |
sudo iptables -A FORWARD -d 2.2.2.2 -i ens160 -p udp -m udp --dport 500:500 -j ACCEP | |
sudo iptables -A FORWARD -d 2.2.2.2 -i ens160 -p udp -m udp --dport 4500:4500 -j ACCEPT | |
sudo iptables -t nat -A PREROUTING -d 1.1.1.1 -p udp -m udp --dport 500:500 -j DNAT --to-destination 2.2.2.2 | |
sudo iptables -t nat -A PREROUTING -d 1.1.1.1 -p udp -m udp --dport 4500:4500 -j DNAT --to-destination 2.2.2.2 | |
sudo iptables -t nat -A POSTROUTING -o ens160 -j MASQUERADE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo certbot certonly --standalone -d registry.example.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Googooli bash function for resolve a hostname to the first IP address or find your public ip address | |
# Example: | |
# $ ipof www.google.com | |
# 216.58.204.132 | |
# find your public ip address when nothing is sent | |
# $ ipof | |
# x.x.x.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
docker ps -a -q | xargs docker rm -f | |
docker images -a -q | xargs docker rmi -f | |
docker volume ls -q | xargs docker volume rm -f | |
docker network ls | xargs docker network rm | |
docker system prune -f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias ansible-playbook="OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES; ansible-playbook" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a classical example of dependency injection. | |
// My class Car receives an instance of an engine and use it in the run method, where it calls the turnOn method. | |
// Note that my Car does not depends on any concrete implementation of engine. | |
// And I'm not importing any other type! Just using a dependency injected instance of something | |
// that responds to a turn_on message. I could say my class Car depends on an interface. | |
// But I did not have to declare it. It is an automatic interface! | |
class Car { | |
constructor(engine) { | |
this.engine = engine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<opml version="1.1"> | |
<body> | |
<outline text="YouTube Subscriptions" title="YouTube Subscriptions"> | |
<outline text="CS Dojo" title="CS Dojo" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UCxX9wt5FWQUAAz4UrysqK9A" /> | |
<outline text="Stinnett Sticks" title="Stinnett Sticks" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UCiDdaCDetfJBhp5o72UP4xA" /> | |
<outline text="Restore It" title="Restore It" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UCYSAWDQnoz0uIBRYlophvNw" /> | |
<outline text="Black Beard Projects" title="Black Beard Projects" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UC8q2GgxOUS_Dzd5KIYeJQIw" /> | |
<outline text="Andre Will Do It" title="Andre Will Do It" type="rss" xmlUrl="https://www.youtube.com/feeds/videos.xml?channel_id=UCad1pq_FAygE4VaDLJMZ8BA" /> | |
<outline text="Hand Tool Rescue" title="Hand Tool Rescue" type="rss" xmlUrl=" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class reverse_iter: | |
def __init__(self, l): | |
self.l = l[::-1] | |
self.i = 0 | |
def __iter__(self): | |
return self | |
def __next__(self): | |
if self.i < len(self.l): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.shuffle = function () { | |
var copy = this.concat() | |
var currentIndex = copy.length | |
while (currentIndex !== 0) { | |
let randomIndex = Math.floor(currentIndex * Math.random()) | |
currentIndex-- | |
let temp = copy[currentIndex] | |
copy[currentIndex] = copy[randomIndex] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ngram_string(string, n=3, remove_space=False): | |
if remove_space: | |
string = string.replace(' ', '') | |
if len(string) < n: | |
return {string: 1} | |
ngrams = dict() | |
for i in range(len(string)-n+1): | |
ngram = string[i:i+n] |