Skip to content

Instantly share code, notes, and snippets.

View darrena092's full-sized avatar

Darren Anderson darrena092

View GitHub Profile
@darrena092
darrena092 / update.rsc
Last active April 1, 2024 09:35
Mikrotik RouterOS DDNS update script for Namecheap domains
:global currentPublicIP
:local host "" # Add your subdomain here
:local domain "" # Add your domain here
:local password "" # Add your access token here
:local ddnsInterface "pppoe-out1"
:local newPublicIP [/ip address get [find interface="$ddnsInterface"] address]
:local unmaskedIP [:pick "$newPublicIP" 0 [:find "$newPublicIP" "/"]]
:local namecheapUpdateURL "https://dynamicdns.park-your-domain.com/update?host=$host&domain=$domain&password=$password&ip=$unmaskedIP"
import ipaddress
import os
import socket
import threading
import sys
network = ipaddress.ip_network('192.168.1.0/24')
def scanport(host, port_number):
@darrena092
darrena092 / MediaHandler.php
Last active August 4, 2017 10:11
Generating public URLs for Sonata Media objects during serialization
namespace AppBundle\Handlers;
use Application\Sonata\MediaBundle\Entity\Media;
use JMS\Serializer\Context;
use JMS\Serializer\GraphNavigator;
use JMS\Serializer\Handler\SubscribingHandlerInterface;
use JMS\Serializer\JsonSerializationVisitor;
class MediaHandler implements SubscribingHandlerInterface {
module LCDFPGA(
clk, //Clock input (50MHz), rising edge.
LCD_RS, //Register select. 0 for command bytes. 1 for data bytes.
LCD_RW, //Read/Write. 0 to write. 1 to read.
LCD_E, //Enable. Active high.
LCD_DataBus //Data bus.
);
//Port declarations
input clk;