Skip to content

Instantly share code, notes, and snippets.

@waako
waako / domains.sh
Last active March 19, 2023 03:37
Lookup A-record and Nameservers for a list of domains in a txt file, output into a csv file
#!/bin/bash
# Put all the domain names in domains.txt, one per line
# then run in the terminal: bash domains.sh
# this will print each domain in the terminal as it looks it up
# The result csv will contains the domain, IP & Nameservers in each column
# Give each column the relevant header titles
echo "Domain Name,IP Address,Nameserver,Nameserver,Nameserver,Nameserver,Nameserver" > domains.csv
while read domain
@waako
waako / rowspan.js
Created February 24, 2023 16:03 — forked from erd0s/rowspan.js
Turn an HTML table with rowspans into a csv with rowspan data duplicated
var rows = document.querySelectorAll("table div table > tbody tr");
var records = [];
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var cells = row.querySelectorAll("td");
cells.forEach((o, j) => {
// Put in the forward rows data
if (o.rowSpan > 1) {
@waako
waako / thermostat.yaml
Last active February 7, 2023 10:25 — forked from Cadair/thermostat.yaml
esphome configuration for my Open Energy Monitor thermostat
# This is an esphome configuration file for the OpenEnergyMonitor Thermostat
# The primary objectives of this configuration file are:
# 1) The temperature used as the sensor for the thermostat should be read from
# homeassistant, this lets you use an average or change the room the
# temperature is based on depending on the time of day etc.
# 2) If homeassisant goes offline the thermostat keeps working.
# To this end there is a sensor "average_temperature" which is recieved from hass
# and a second sensor "combined_temperature" which decides based on if a device
# is connected to the native API or not to use this sensor or the local sensor
# attached to the thermostat.
@waako
waako / themename.theme.php
Created June 19, 2016 16:48
Drupal 8: get a block's parent node title and absolute url and pass it as variable
<?php
/**
* Implements hook_preprocess_HOOK() for block.html.twig.
*/
function themename_preprocess_block(&$variables) {
// Get Title of Block's parent Node.
$request = \Drupal::request();
$route_match = \Drupal::routeMatch();
@waako
waako / .htaccess
Created July 14, 2016 15:16
redirect all traffic to https, except one page, and ensure that page is served on http
# Force HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/who-we-are/careers$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Ensure that Careers page is not forced over HTTPS
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/who-we-are/careers$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@waako
waako / babel.config.js
Last active October 20, 2020 09:29 — forked from zkat/index.js
npx is cool
{ "comments": false, "minified": true, "plugins": [ "minify-mangle-names", "transform-merge-sibling-variables", "transform-minify-booleans", "transform-remove-console" ], "presets": [ [ "@babel/preset-env", { "targets": { "ie": "11" } } ] ] }
@waako
waako / _info.md
Last active April 6, 2020 14:14 — forked from niallsmart/copy-checklist.js
Copy Card title, url, attachments and checklists to clipboard

Copy Trello card elements to clipboard in Markdown format

Instructions

  1. Open trello card in browser
  2. Open browser devtools to console tab
  3. Paste copy-card-info.js contents into console
  4. Run script
  5. Card information written to clipboard
@waako
waako / _instructions.md
Last active April 6, 2020 14:01
Copy trello card title, url, attachments & checklists for pasting into CSV

Easy(ish) way to copy Trello card elements into CSV format

Following content is extracted into columns currently:

  • Title
  • URL
  • Trello Attachments (other cards linked from this card)
  • Checklists (1 column per checklist, currently up to 7 but just add more to csv file headers)

Instructions

@waako
waako / .csscomb.json
Created January 19, 2017 15:51
Gulp workflow for Drupal 8 theme. Includes csscomb for Drupal CSS Code Standards and Sass Lint
{
"exclude": [
".git/**",
"misc/**",
"modules/**",
"profiles/**",
"themes/**",
"node_modules/**",
"bower_components/**"
],
@waako
waako / themename.theme.php
Last active June 17, 2019 12:54
Drupal 8: Get Block's parent Node title and full URL
<?php
use Drupal\Core\Url;
/**
* Implements hook_preprocess_HOOK() for block.html.twig.
*/
function themename_preprocess_block(&$variables) {
// Get Title of Block's parent Node.
$request = \Drupal::request();