Skip to content

Instantly share code, notes, and snippets.

# Fetches data from https://www.energidataservice.dk/tso-electricity/elspotprices
# API documentation http://docs.ckan.org/en/latest/api/index.html#making-an-api-request
from datetime import datetime, timedelta
import time
import requests
from influxdb import InfluxDBClient
import paho.mqtt.client as mqtt
@XioNoX
XioNoX / autorsi.py
Last active October 18, 2024 16:14
Generate then download Juniper RSI and logs. Optionally uploads them to the matching JTAC case.
#!/usr/bin/env python3
# usage: autorsi.py [-h] [--username USERNAME] [--sshconf SSHCONF] [--case CASE]
# hostname
#
# Generate then download RSI and logs. Optionally upload them to the matching
# JTAC case.
#
# positional arguments:
# hostname Device to connect to
#

ICMPv6 Firewall Rules

Allow in ICMP messages (highly recommended)

ip6tables -A INPUT   -p ipv6-icmp -m icmp6 --icmpv6-type 128 \
-m --comment Permit-EchoRequest   -j ACCEPT

ip6tables -A INPUT   -p ipv6-icmp -m icmp6 --icmpv6-type 129 \
-m --comment Permit-EchoReply     -j ACCEPT
@mutin-sa
mutin-sa / Top_Public_Time_Servers.md
Last active November 18, 2024 05:01
List of Top Public Time Servers

Google Public NTP [AS15169]:

time.google.com

time1.google.com

time2.google.com

time3.google.com

@mcastelino
mcastelino / tc mirroring.md
Last active October 19, 2024 15:35
Using tc redirect to connect a virtual machine to a container network

Connecting a veth device to tap

  • veth device from CNI/CNM plugin: eth0
  • tap device that connects to the VM: tap0

Redirecting traffic between the two devices

tc qdisc add dev eth0 ingress
tc filter add dev eth0 parent ffff: protocol all u32 match u8 0 0 action mirred egress redirect dev tap0
KEYBINDINGS
byobu keybindings can be user defined in /usr/share/byobu/keybindings/ (or within .screenrc if byobu-export was used). The common key bindings
are:
F2 - Create a new window
F3 - Move to previous window
F4 - Move to next window
@akorobov
akorobov / ipv6-httpd.py
Created December 11, 2013 00:58
quick ipv6 http server using python's SimpleHttpServer
import socket
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
class MyHandler(SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/ip':
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Syntax: $_ USER[ USER[ ...]]" >&2
exit 1
fi
exit_code=0
for user in "$@"; do
home="/home/$user"
@mendelgusmao
mendelgusmao / btsync
Last active March 4, 2021 15:37
init.d script for btsync (based on another script built to run dropbox)
#!/bin/sh
### BEGIN INIT INFO
# Provides: btsync
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Multi-user daemonized version of btsync.
@jirutka
jirutka / rules-both.iptables
Created September 18, 2012 12:42
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <[email protected]>.
#
# 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