Skip to content

Instantly share code, notes, and snippets.

spig /
Last active Apr 5, 2021
Get IP Address for ddclient from a TP-LINK Router

Get IP Address for use in ddclient from a TP-LINK Router

Retrieve the local IP address by screen scraping the router's web page using a ruby script from a server behind the router

To use in ddclient:


spig /
Created Aug 19, 2020
Remove old projects via the Jenkins API
# Replace JobName with the job name and ProjectName with the project name
for JOB in {246..254}
do curl -u $JENKINS_USER_NAME:$JENKINS_API_TOKEN -X POST http://$JENKINS_SERVER:$JENKINS_PORT/view/ProjectName/job/JobName/$JOB/doDelete
docker run \
--name ubuntu \
-e HOST_IP=$(ifconfig en0 | awk '/ *inet /{print $2}') \
-v /Users/hudson/Workspaces:/src \
-t -i \
ubuntu /bin/bash
spig / getText.js
Last active Oct 14, 2019
Get text of matching elements
View getText.js
Array.from(document.getElementsByClassName("CLASSNAME")).map(e => e.textContent).join(',');
View main.cpp
int main(int args, const char * argv[]) {
int userNum;
cout << "Enter a number: ";
cin >> userNum;
while (userNum >= 4) {
userNum = userNum / 4;
cout << userNum << " ";
spig / dropboxcopy.bat
Created Apr 4, 2019
Copy all files in a folder to another folder with a pause and an infinite loop
View dropboxcopy.bat
goto :loop
echo Copying Files
copy *.jpg "C:\Users\vPro Demo\Dropbox\folder"
timeout /t 30
goto :loop
spig / processRow.js
Created Oct 27, 2018
Process a table row to get some text information from it
View processRow.js
function processRow(row) {
let items = [... row.getElementsByTagName("td")]
let elementName = items[2].innerText
let elementSymbol = items[1].innerText
let atomicNumber = items[0].innerText
return elementName + ", " + elementSymbol + ", " + atomicNumber
var elements = [... document.getElementsByTagName("tr")].splice(1,).map(processRow).join('<br/>\n')
spig / open-network-port-through-firewall.txt
Last active May 15, 2018
Update firewall on CentOS 7
View open-network-port-through-firewall.txt
Taken from
Open a Port on CentOS/RHEL 7
Starting with CentOS and RHEL 7, firewall rule settings are managed by firewalld service daemon. A command-line client called firewall-cmd can talk to this daemon to update firewall rules permanently.
To open up a new port (e.g., TCP/80) permanently, use these commands.
$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload
spig / randomLengthSubstrings.swift
Created Apr 18, 2018
Random Length Substrings
View randomLengthSubstrings.swift
static let titleArray = "Youth Theme 2015: O YE THAT EMBARK IN THE SERVICE OF GOD".split(separator: " ")
static let artistArray = "Elijah Thomas, Kyle Thorn, Maddie Wilson, Grayson O'Very, Anna Richey, Nick Neel, Baily Lawson".split(separator: ",")
public func getRandomTitle() -> String {
return getRandomLengthString(from: type(of: self).titleArray, separator: " ")
public func getRandomArtist() -> String {
return getRandomLengthString(from: type(of: self).artistArray, separator: ",")
spig /
Created Feb 15, 2018 — forked from jpawlowski/
Install and configure CUPS 2.1.2 on CentOS 7 (LXC running on Proxmox VE) host including AirPrint

Basic setup, e.g. enable ssh

yum -y install epel-release
yum -y upgrade
yum -y install openssh-server net-tools iputils psmisc less which man mc bash-completion bash-completion-extras bash-argsparse bind-utils traceroute htop mtr
echo "export HISTTIMEFORMAT='%F %T  '" > /etc/profile.d/
echo "export HISTIGNORE='ls -l:pwd:date:'" >> /etc/profile.d/
echo "export HISTCONTROL=ignoredups" >> /etc/profile.d/
systemctl enable sshd
systemctl start sshd