Skip to content

Instantly share code, notes, and snippets.

View tuupola's full-sized avatar

Mika Tuupola tuupola

View GitHub Profile
@tuupola
tuupola / gandi.sh
Created September 10, 2023 20:56
Update GANDI dynamic DNS
#!/usr/bin/bash
API_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
DOMAIN="example.com"
SUBDOMAIN="dynamic"
CURRENT_IP=$(curl --silent --header "Authorization: Bearer $API_KEY" https://dns.api.gandi.net/api/v5/domains/$DOMAIN/records/$SUBDOMAIN/A | jq -r ".rrset_values[0]")
EXTERNAL_IP=$(curl --silent ifconfig.io)
JSON=$(cat <<EOF
{
INFO global: Vagrant version: 2.2.19
INFO global: Ruby version: 3.1.2
INFO global: RubyGems version: 3.3.7
INFO global: VAGRANT_EXECUTABLE="/usr/share/vagrant/gems/bin/vagrant"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_PREFERRED_PROVIDERS="libvirt,docker"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/usr/share/vagrant"
INFO global: VAGRANT_LOG="debug"
INFO global: VAGRANT_DETECTED_OS="Linux"
@tuupola
tuupola / 00-code.php
Last active September 20, 2021 14:20
try {
$mailer->send($email);
} catch (TransportException $exception) {
var_dump($exception->getMessage());
}
while ($worker->work()) {
if (1000 < ++$jobs) {
print "Job limit reached, exiting worker {$pid}.\n";
$worker->unregisterAll();
exit();
}
$memory = memory_get_usage(true);
print "Worker {$pid} running job number {$jobs} memory usage is {$memory}.\n";
@tuupola
tuupola / macos.txt
Last active November 9, 2020 10:07
angle:0 s:0.000000 c:1.000000 z:0.000000
angle:1 s:0.017452 c:0.999848 z:0.020943
angle:2 s:0.034899 c:0.999391 z:0.041879
angle:3 s:0.052336 c:0.998630 z:0.062803
angle:4 s:0.069756 c:0.997564 z:0.083708
angle:5 s:0.087156 c:0.996195 z:0.104587
angle:6 s:0.104528 c:0.994522 z:0.125434
angle:7 s:0.121869 c:0.992546 z:0.146243
angle:8 s:0.139173 c:0.990268 z:0.167008
angle:9 s:0.156434 c:0.987688 z:0.187721
<?php
function pmt($interest, $payments, $pv, $fc = 0.00, $type = 0)
{
$xp = pow((1 + $interest), $payments);
return
($pv * $interest * $xp / ($xp - 1) + $interest / ($xp - 1) * $fc) *
($type == 0 ? 1 : 1 / ($interest + 1));
}
s.click.aliexpress.com
best.aliexpress.com
createsend.com
http {
# Disable sending the server identification
server_tokens off;
# Prevent displaying Botpress in an iframe (clickjacking protection)
add_header X-Frame-Options SAMEORIGIN;
# Prevent browsers from detecting the mimetype if not sent by the server.
add_header X-Content-Type-Options nosniff;