Skip to content

Instantly share code, notes, and snippets.

View RolandWarburton's full-sized avatar
🍃

Roland RolandWarburton

🍃
View GitHub Profile
@RolandWarburton
RolandWarburton / docker_api.md
Last active February 20, 2021 02:34
docker stuff for remote endpoints

Docker remote endpoints for portainer

Step 1 - Installing docker

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
@RolandWarburton
RolandWarburton / linux_interface_vlans.md
Created February 6, 2021 03:02
linux interface vlans
sudo ip link add link eno1 name eno1.10 type vlan id 10
sudo ip addr add 10.10.10.15/24 dev eno1.10
sudo ip link set dev eno1.10 up
@RolandWarburton
RolandWarburton / Direwolf20_dockerfile
Last active January 27, 2021 09:13
Direwolf20 FTB docker
FROM openjdk:8-jre
# Install stuff and prep the container
RUN apt-get update && apt install apt-utils --yes
RUN apt-get upgrade --yes --allow-remove-essential
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
# The server will be installed here
RUN mkdir -p /usrc/src/server/world
@RolandWarburton
RolandWarburton / studyThis.js
Created November 27, 2020 15:48
found this
// TODO study this thing
// https://stackoverflow.com/questions/54954091/how-to-use-callback-with-usestate-hook-in-react
function useSearchFilterCallback(initialState) {
const [state, setState] = useState(initialState);
const cbRef = useRef(null); // mutable ref to store current callback
const setStateCallback = (state, cb) => {
cbRef.current = cb; // store passed callback to ref
setState(state);
};
@RolandWarburton
RolandWarburton / foreachJSON.ejs
Created October 15, 2020 12:46
EJS for each json keys
<% Object.entries(record).forEach(([key, val]) => { %>
<li class="<%= key %>" id="<%= val %>"><strong><%= key %></strong>: <%= val %></li>
<% }); %>
@RolandWarburton
RolandWarburton / sortingInts.js
Last active September 5, 2020 09:06
sorting int arrays in javascript
const a = 9999
const b = 100
const arr = [9999,100]
// sort function
const res = (a, b) => {return a-b}
// "sort" 2 numbers on their own returns the result from the subtraction
console.log(res(a,b))
@RolandWarburton
RolandWarburton / backupCORS.js
Created August 26, 2020 14:57
backup cors. for when all else fails
app.use((req, res, next) => {
debug("running cors");
res.header(
"Access-Control-Allow-Headers",
"Origin, X-Requested-With, COntent-Type, Accept, Authorization"
);
// Or drop a tactical nuke with
// res.header("Access-Control-Allow-Headers", "*");
if (req.method === "Options") {
res.header(
@RolandWarburton
RolandWarburton / downloader.js
Created August 13, 2020 13:06
markdown url downloader
const fs = require("fs");
const fetch = require("node-fetch");
const debug = require("debug")("staticFolio:fetch-content");
const chalk = require("chalk");
const mkdirp = require("mkdirp");
const path = require("path");
const dotenv = require("dotenv").config();
const downloadMarkdown = async (url) => {
url = decodeURI(url);
@RolandWarburton
RolandWarburton / youtubeLinkExtractor.js
Last active July 22, 2020 08:51
youtube Link Extractor from a file of js links
// __ __ __ __ ___ ____ ____
// \ \/ /___ __ __/ /___ __/ /_ ___ / | / __ \/ _/
// \ / __ \/ / / / __/ / / / __ \/ _ \ / /| | / /_/ // /
// / / /_/ / /_/ / /_/ /_/ / /_/ / __/ / ___ |/ ____// /
// /_/\____/\__,_/\__/\__,_/_.___/\___/ /_/ |_/_/ /___/
// Extract {title, channelId, publishedAt} from an array of youtube links
// Make sure to use an API key below
//
// A good way i found of getting lists of youtube urls is to use Link Gopher.
// Though the results do require some minimal filtering to get only youtube watch URLs
@RolandWarburton
RolandWarburton / autoindex_fancy.html
Created June 27, 2020 10:05
fancy index for nginx autoindex
<style>
body {
background: #121212 !important;
color: #dedede !important;
font-size: 1.25em;
}
a, a:visited {
color: #dedede;
}
</style>