Skip to content

Instantly share code, notes, and snippets.

View algb12's full-sized avatar

Alexander Gilburg algb12

View GitHub Profile
@algb12
algb12 / perscription-terms-finder.py
Last active October 18, 2022 12:45
This script gets the contents of your website, screens them for perscription medicine terms which would flag-up as policy violations in Google Ads, and generates a report detailing on which page those violations are visible. A good use-case for this tool would be in the cosmetic marketing niche, which can often be tricky due to the restrictions …
#!/usr/bin/env/python
# POM terms finder for Google Ads campaigns - v1.0
# Python 3.5+
# Make sure to install PyWebCopy and BeautifulSoup before using this tool, like so:
# pip install pywebcopy bs4
from bs4 import BeautifulSoup
from glob import glob
import os
@algb12
algb12 / pfs-receiver.py
Last active February 15, 2022 00:29
Poetizer File-System (PFS) - Receiver
#!/usr/bin/env python3
# Poetizer File-System (PFS)
# Receiver
#
# LICENSE: Public Domain
# AUTHOR: Anonymous
#
# NOTE: Do not take this seriously please,
# it's just a little fun project by a web-dev
@algb12
algb12 / tnp-ajaxify.html
Last active January 4, 2021 20:12
Code to AJAXify The Newsletter Plugin subscription form
<script type="text/javascript" id="tnp-subscription-ajax">
// Wait for jQuery to load
jQuery(document).ready(function($) {
// Identify form through submit button
var form = $('.tnp-submit').parent().closest('form');
// This is the syntax to target the form associated with the submit button (keeps form validation)
form.submit(function(e) {
// Only trigger if it's the subscribe form, and not any other type of form
if (form.attr('action').endsWith("?na=s")) {
@algb12
algb12 / UDPGeolocate.sh
Last active June 7, 2021 19:34
Geolocates strangers on Omegle, Chatroulette and similar sites. Tested on OS X 10.10.5 and Ubuntu 16.04.
#!/bin/bash
# Real-time UDP IP Geolocator
printf "### REAL-TIME UDP IP GEOLOCATOR ###\n"
printf "===================================\n"
# Query user options
read -p "Please enter the interface on which to listen for connections (Default: Detection by script): " interface
read -p "Please enter the minimum packet size which should trigger a frame recording (Default: 200): " minPackLen
read -p "Please enter the UDP port number on which to listen for connections (Default: Detection by script (follow instructions later on in config!)): " port
<?php
// AUTHOR: algb12
// An implementation of the Pascal's triangle in PHP
// It is relatively fast, even with values in the 100s and 1000s
function pascalRow($n)
{
// Every Pascal's triangle starts with a 1
$row = [1];
// If row number ($n) is 0, just return an array with 1 in it
@algb12
algb12 / getChange.php
Last active September 17, 2016 21:19
Takes a sum of money, and returns an array expressing this sum in terms of a currency's denominations in the most efficient way possible.
<?php
// This function takes an array of denominations for a currency and a sum, and returns an array describing the most efficient way to express the sum in terms of denominations.
// E.g. A sum, such as 200 EUR can be expressed in terms of 100x2, which is inefficient, as there is the denomination 200 for this job.
// The function will return the most efficient way to express the sum, not 100x2, but 200x1.
// Recommended to round both, the expected and actual value to 2 decimal places.
// FUNCTION
// getChange function
function getChange($sum, $denominations) {
@algb12
algb12 / AppNapToggle.pl
Last active April 18, 2024 09:13
AppNapToggle.pl - App Nap disabler / enabler
#!/usr/bin/perl
use 5.010;
use vars qw($VERSION);
use strict;
use warnings;
use Getopt::Long qw(GetOptions);
Getopt::Long::Configure qw(gnu_getopt);
use Cwd 'abs_path';
use File::Basename;