Skip to content

Instantly share code, notes, and snippets.

<?php
require "xkcd.config.php";
//$lastfile=__DIR__.".xkcd_last"; // temporary file to keep track of the last comic posted
//$whurl="https://discordapp.com/api/webhooks/.../..."; // get this url from discord
//$xkcdurl="https://xkcd.com/rss.xml"; // get this url from xkcd oh wait i already got it
$xml=new SimpleXMLElement(file_get_contents($xkcdurl));
$item=$xml->channel->item;
$guid=$item->guid;
$lastguid=file_get_contents($lastfile);
if(trim($lastguid)===trim($guid)){
@iggyvolz
iggyvolz / myclass.php
Last active August 15, 2019 11:33
Demo of PHP Preload
<?php
echo "myclass.php required".PHP_EOL;
class MyClass
{
public function MyFunction():void
{
echo "This is a function!".PHP_EOL;
}
}
<?php
require_once "config.php"; // defines YOUTUBE_PLAYLIST (the id of the playlist), YOUTUBE_TOKEN (https://www.slickremix.com/docs/get-api-key-for-youtube/), DISCORD_TOKEN (https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token), and DISCORD_CHANNEL (right-click channel, copy ID)
require_once __DIR__.'/vendor/autoload.php'; // composer require restcord/restcord
use RestCord\DiscordClient;
$conts=json_decode(file_get_contents("https://www.googleapis.com/youtube/v3/playlistItems?part=contentDetails&maxResults=50&playlistId=".YOUTUBE_PLAYLIST."&key=".YOUTUBE_TOKEN));
$count=count($conts->items);
$index=random_int(0,$count);
$videoid=$conts->items[$index]->contentDetails->videoId;
$discord = new DiscordClient(['token' => DISCORD_TOKEN]); // Token is required
$discord->channel->createMessage(['channel.id' => DISCORD_CHANNEL, 'content' => 'VGM of the Day - '.date("m/d/y").' https://www.youtube.com/watch?v='.$videoid]);
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/8.0.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8.0.1
/usr/bin/cmake -H/home/ryan/CRYENGINE -B/home/ryan/CRYENGINE/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/ryan/CRYENGINE/build/CMakeFiles /home/ryan/CRYENGINE/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/ryan/CRYENGINE/build'
make -f Code/Libs/lz4/CMakeFiles/lz4.dir/build.make Code/Libs/lz4/CMakeFiles/lz4.dir/depend
make[2]: Entering directory '/home/ryan/CRYENGINE/build'
cd /home/ryan/CRYENGINE/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/ryan/CRYENGINE /home/ryan/CRYENGINE/Code/Libs/lz4 /home/ryan/CRYENGINE/build /home/ryan/CRYENGINE/build/Code/Libs/lz4 /home/ryan/CRYENGINE/build/Code/Libs/lz4/CMakeFiles/lz4.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/ryan/CRYENGINE/build'
make -f Code/Libs/lz4/CMakeFiles/lz4.dir/build.make Code/Libs/lz4/CMakeFiles/lz4.dir/build
make[2]: Entering directory '/home/ryan/CRYENGINE/build'
namespace CryEngine.Game
{
[EntityComponent(Guid="8edf52be-45b8-d8f1-0cd5-e784c1abacd2")]
public class PlayerController : EntityComponent
{
/// <summary>
/// Called at the start of the game.
/// </summary>
protected override void OnGameplayStart()
{
#include <cstdlib>
#include<iostream>
class x
{
public:
static void y();
static void z();
static void q();
};
void x::y(){
/usr/bin/ld \
-plugin \
/usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so \
-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper \
-plugin-opt=-fresolution=/tmp/ccYn5Pdj.res \
-plugin-opt=-pass-through=-lgcc_s \
-plugin-opt=-pass-through=-lgcc \
-plugin-opt=-pass-through=-lc \
-plugin-opt=-pass-through=-lgcc_s \
-plugin-opt=-pass-through=-lgcc \
libbackend.a(DBowInterfaceSurf.cpp.o): In function `DBowInterfaceSurf::detectSURF(cv::Mat const&, std::vector<float, std::allocator<float> >&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&)':
DBowInterfaceSurf.cpp:(.text+0x6a9): undefined reference to `cv::SURF::operator()(cv::_InputArray const&, cv::_InputArray const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, cv::_OutputArray const&, bool) const'
DBowInterfaceSurf.cpp:(.text+0x6f6): undefined reference to `cv::SURF::descriptorSize() const'
DBowInterfaceSurf.cpp:(.text+0xb1d): undefined reference to `cv::SURF::SURF(double, int, int, bool, bool)'
libbackend.a(DBowInterfaceSurf.cpp.o): In function `cv::SURF::~SURF()':
DBowInterfaceSurf.cpp:(.text._ZN2cv4SURFD1Ev[_ZN2cv4SURFD1Ev]+0x2): undefined reference to `VTT for cv::SURF'
DBowInterfaceSurf.cpp:(.text._ZN2cv4SURFD1Ev[_ZN2cv4SURFD1Ev]+0xc): undefined reference to `vtable for cv::SURF'
libbackend.a(DBowInterfaceSurf.cpp.o): In function `DLoopDetector::TemplatedLoopDetector<std::ve
using System;
class GodotError : Exception
{
public string Name { get; private set; }
public GodotError(int errorCode)
{
Name = typeof(GodotError).GetEnumName(errorCode);
}
public override string ToString()