Skip to content

Instantly share code, notes, and snippets.

View Ry-DS's full-sized avatar

Ryan Samarakoon Ry-DS

View GitHub Profile
@Ry-DS
Ry-DS / network_usage.py
Last active September 3, 2023 03:13
Useful script to alert ntfy if network usage is high for a sustained period (after the transfer is completed)
# Majority AI Generated (GPT-4)
import time
import subprocess
import psutil
import sys
# Set the threshold for high network usage (in bytes per second)
# 10MB
HIGH_USAGE_THRESHOLD = 10000000
@Ry-DS
Ry-DS / wol_server.py
Last active September 2, 2023 13:01
A simple REST server to send a WOL packet to my broadcast address (allows a browser to wake a PC)
# Python server with cors accepts incoming requests from the client and wakes pc
from flask import Flask, jsonify, request
from flask_cors import CORS
from wakeonlan import send_magic_packet
app = Flask(__name__)
CORS(app)
# run flask in prod mode
app.config['ENV'] = 'production'
@Ry-DS
Ry-DS / RainbowDrops.xml
Created October 5, 2022 02:03
A dark rainbow theme for Intellij (my favourite). In Eclipse format but should still be importable to Intellij. Source: https://github.com/guari/eclipse-ui-theme/blob/master/com.github.eclipseuitheme.themes.plugin/bin/color-scheme/RainbowDrops.xml
<?xml version="1.0" encoding="utf-8"?>
<colorTheme id="24587" name="RainbowDrops" modified="2014-02-19 15:47:49" author="guari" website="https://github.com/guari/eclipse-ui-theme">
<searchResultIndication color="#D8D8D8" />
<filteredSearchResultIndication color="#D8D8D8" />
<occurrenceIndication color="#484848" />
<writeOccurrenceIndication color="#335A72" />
<findScope color="#1E789B" />
<deletionIndication color="#863C43" />
<sourceHoverBackground color="#444444" />
<singleLineComment color="#626262" />
@Ry-DS
Ry-DS / set_dns.ps1
Last active October 4, 2022 09:25
Script to set the IP of your DynDNS record from namecheap
# A powershell to set the IP of your DynDNS enabled domain on namecheap
$IP=(Invoke-WebRequest -uri "http://ifconfig.me/ip").Content
echo ("Setting IP "+$IP+" for DynDNS")
Invoke-WebRequest -uri ("https://dynamicdns.park-your-domain.com/update?host=home&domain=ryan-s.me&password=???&ip="+$IP)
@Ry-DS
Ry-DS / csv_netsh.py
Created August 16, 2022 16:36
For Windows: Save all Wifi WLAN networks to a CSV file
# A command line utility to save all wlan networks dectected by your PC into a .csv file.
# Only works on Windows (using the built in netsh tool)
# Usage: python .\csv_netsh.py out.csv
import sys
from subprocess import Popen, PIPE
def process_block(block, out_lines):
ssid_name = block[0].split(':')[1].strip()
@Ry-DS
Ry-DS / SignUp.js
Last active March 18, 2021 08:46
From HackMelbourne's DECODED 2021
// Source: https://raw.githubusercontent.com/HackMelbourne/find-a-friend/live-coding-session-1/src/pages/SignUp.js
// Edited to include background image
import React from "react";
import {
AppBar,
Avatar,
Grid,
Paper,
Toolbar,
TextField,
import React from 'react';
import PropTypes from 'prop-types';
import axios from 'axios';
import LoadingAnimation from "./LoadingAnimation";
import Plyr from 'plyr';
import Hls from 'hls.js';
import 'plyr/dist/plyr.css';
CloudflareSecureStream.propTypes = {
videoId: PropTypes.string.isRequired,
import React from 'react';
import PropTypes from 'prop-types';
//remove annoying custom stream tag error
const realError = console.error;
console.error = (...x) => {
if (x[0].startsWith('Warning: The tag <%s> is unrecognized in this browser. ' +
'If you meant to render a React component, start its name with an uppercase letter.')) {
console.log('Suppressing Stream Error...');
return;