Skip to content

Instantly share code, notes, and snippets.

View DanTup's full-sized avatar

Danny Tuppeny DanTup

  • Coded Consultants Ltd
  • England, UK
  • 17:12 (UTC +01:00)
  • X @DanTup
View GitHub Profile
@DanTup
DanTup / delete_comments_likes.js
Last active October 17, 2023 21:51
Delete all Facebook posts for a year
// Only tested in Chrome...
// Must browse to "Your Comments" (or "Your Likes") page of activity feed, then pre-load the year you want to delete
// and as many comments as possible (scroll down, they load lazily).
//
// I ACCEPT ABSOLUTELY NO RESPONSIBILITY FOR THIS DOING BAD STUFF. THE NEXT FACEBOOK DEPLOYMENT
// COULD WELL BREAK THIS, OR MAKE IT DO THINGS YOU DO NOT EXPECT. USE IT AS A STARTING POINT ONLY!
//
// It will start failing once it gets to the end, just reload the page and kick it off again.
var rows = document.querySelectorAll('#year_2012 .pam._5shk');
@DanTup
DanTup / main.dart
Created October 24, 2022 18:37
quintessential-dryad-3795
void main() {
var num = 5;
var factorial = 1;
for( var i = num ; i >= 1; i-- ) {
factorial = factorial * i ;
print(factorial);
}
print(factorial);
}
<!DOCTYPE html>
<html>
<head>
<title>MySecondGame</title>
</head>
<body>
<canvas width="1024" height="768"></canvas>
<div style="display: none;">
<img id="img-player" src="assets/player.png" />
@DanTup
DanTup / paths.dart
Last active April 6, 2022 22:25
Sudoku Killer Cage path calculations
import 'package:built_collection/built_collection.dart';
import 'package:flutter/painting.dart';
import 'package:sudoku/src/model/model.dart';
import 'package:sudoku/src/model/model_extensions.dart';
typedef CellSelector = CellCoordinate Function(CellCoordinate);
class InsetInfo {
/// The relative cell to check for selection to know if we need a line along
/// this edge.
@DanTup
DanTup / Dart.plist
Created January 27, 2022 14:31
Basic Language Module for BBEdit to recognise Dart
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BBEditDocumentType</key>
<string>CodelessLanguageModule</string>
<key>BBLMLanguageDisplayName</key> <string>Dart</string>
<key>BBLMLanguageCode</key> <string>Dart</string>
@DanTup
DanTup / dart_download.strace
Last active May 10, 2019 16:38
Simple Dart script to download data for testing WSL hangs
This file has been truncated, but you can view the full file.
4514 execve("/home/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/dart", ["/home/danny/Dev/Google/flutter/b"..., "./dart_download_test.dart"], [/* 18 vars */]) = 0
4514 brk(NULL) = 0x2c1c000
4514 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
4514 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa18d450000
4514 readlink("/proc/self/exe", "/home/danny/Dev/Google/flutter/b"..., 4096) = 58
4514 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
4514 open("/home/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/tls/x86_64/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
4514 stat("/home/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/tls/x86_64", 0x7fffd5f28bb0) = -1 ENOENT (No such file or directory)
4514 open("/home/danny/Dev/Google/flutter/bin/cache/dart-sdk/bin/tls/libdl.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
4514 stat("/home/danny/Dev/Google/f
@DanTup
DanTup / proxy_test.dart
Created January 2, 2019 09:56
Dart localhost WebSocket proxy test script
import 'dart:io';
var port = 3456;
main() async {
print('HTTP_PROXY: ${Platform.environment['HTTP_PROXY']}');
print('NO_PROXY: ${Platform.environment['NO_PROXY']}');
print('');
await test('ws://echo.websocket.org');
@DanTup
DanTup / README.md
Last active December 16, 2018 19:53
Custom Cura definition for Monoprice Ultimate

Copy this JSON file to ~/Library/Application Support/cura/3.6/definitions/monoprice_ultimate.def.json on macOS (note the Cura version in the path). It'll list a new printer (Monoprice Ultimate) that inherits the Wanhao Duplicator 6 profile but with the correct acceleration/jerk values (at least the defaults for mine).

This will improve the accuracy of time estimates (for example, a Tito head estimated 4hrs without this change, and 7:22 with it - which looks about right given it's 55% through the Gcode after 4:10!).

@DanTup
DanTup / LaunchKiln.ps1
Last active May 11, 2018 18:43
PowerShell function to launch Kiln in a browser for the repo you're currently in.
# Launch Kiln for current repo
Function Kiln
{
if (Test-Path ".\.hg\hgrc")
{
$repoUrl = (Select-String "default = (.*)" -Path ".\.hg\hgrc" -AllMatches).Matches.Groups[1].Value
Start $repoUrl
}
else
{ Write-Warning "Not in a repo!" }
@DanTup
DanTup / Actual cube state.txt
Created March 16, 2017 15:43
MindCub3r Logs
w w w
o o r
g o r
o w y r g y b y g r b b
g b g w y o b g o y w y
y w b r b g o y o g g o
w r y
r r b
b r y