Skip to content

Instantly share code, notes, and snippets.

@cchana
cchana / post2bluesky.php
Last active December 4, 2024 19:00
A brief script that will log you into Bluesky and post 'Hello, world!'. It saves the session info to bsky.tokens so you can continue to post
<?php
# Login info, set an app password at https://bsky.app/settings/app-passwords
$password = 'p4ssw0rd';
$handle = 'your.handle';
# URL and data for creating a session
$apiKeyUrl ='https://bsky.social/xrpc/com.atproto.server.createSession';
$apiKeyPostData='{"identifier": "'.$handle.'", "password": "'.$password.'" }';
@derickr
derickr / equinox.php
Last active September 16, 2024 16:15
PHP script to calculate the times of solstices and equinoxes
<?php
/* Algorithms taken from Meeus Astronomical Algorithms, 2nd edition */
/* Run the php script on the command line:
* php equinox.php <year> <what>
* with <what> being MAR, JUN, SEP, or DEC
*
* For the the Summer Solstice of 2020:
* php equinox.php 2020 JUN
*/