Skip to content

Instantly share code, notes, and snippets.

View KaiserWerk's full-sized avatar

Robin K. KaiserWerk

  • Germany
View GitHub Profile
@KaiserWerk
KaiserWerk / ICS.php
Created December 18, 2017 11:13 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):
@KaiserWerk
KaiserWerk / email_attachments_ses_simple.php
Created December 28, 2017 10:31 — forked from sandys/email_attachments_ses_simple.php
Script to send email using Amazon SES with attachments in PHP
<?php
require("./amazon-sdk/sdk.class.php");
// on ubuntu - this script can be run using php5-cli and php5-curl
//Provide the Key and Secret keys from amazon here.
$AWS_KEY = "kkk";
$AWS_SECRET_KEY = "kkkk+xKcdkB";
//certificate_authority true means will read CA of amazon sdk and false means will read CA of OS
$CA = true;
@KaiserWerk
KaiserWerk / readme.md
Created April 30, 2018 13:54 — forked from RaVbaker/readme.md
[HOWTO] Rewrite all urls to one index.php in Apache

Redirect All Requests To Index.php Using .htaccess

In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:

Simple Example

This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-d

@KaiserWerk
KaiserWerk / DiscordClient.class.php
Created May 4, 2018 12:18
This class lets you send messages to Discord through their webhook service.
<?php
/*
* This class lets you send a message to Discord through a webhook.
*
* Usage:
* $discord = new DiscordClient('URL-FROM-DISCORD-GOES-HERE');
* $discord->name('Optional'); // If not set, uses the name set in Discord
* $discord->avatar('Optional'); // If not set, uses the avatar set in Discord
* $discord->message('Here is where the message can optionally go.'); // If not set, uses the message provided in $this->send()
* $discord->send('Here is where the message can optionally go.');
@KaiserWerk
KaiserWerk / scrape.php
Last active January 11, 2021 12:46 — forked from jongacnik/scrape.php
Tumblr image scrape
<?php
$offset = 0;
$count = 50;
$domain = $argv[1];
$tagged = isset($argv[2]) ? $argv[2] : false;
$api = 'http://' . $domain . '.tumblr.com/api/read/json?debug=1&num=' . $count . ($tagged ? '&tagged=' . $tagged : '');
function scrape ($api, $count, $offset) {