Skip to content

Instantly share code, notes, and snippets.

View FabianBeiner's full-sized avatar
I need coffee.

Fabian Beiner FabianBeiner

I need coffee.
  • STAR COOPERATION GmbH
  • Berlin, Germany
  • 06:00 (UTC +02:00)
  • X @FabianBeiner
View GitHub Profile
@FabianBeiner
FabianBeiner / scalable_pdf_rename.sh
Created February 1, 2024 07:55
Scalable Capital - PDF Renamer
#!/bin/bash
# Scalable Capital - PDF Renamer
# This script is designed to rename PDF files obtained from Scalable Capital,
# where the filenames start with a 22-character random string followed by a date and a description.
# It removes the random string, formats the date as 'YYYY-MM-DD', and adds a hyphen
# to create a more human-readable and consistent file name.
# Example:
# Original File Name: '2fFabUoFC14sfGZCZ7FJpa 20231004 Monatlicher Kontoauszug Broker Baader Bank.pdf'
@FabianBeiner
FabianBeiner / MyFitnessPal-Measurements.json
Created December 14, 2020 10:01
Web Scraper (https://webscraper.io/) Sitemap for MyFitnessPal Measurements
{"_id":"myfitnesspal","startUrl":["https://www.myfitnesspal.com/de/measurements/edit"],"selectors":[{"id":"pagination","type":"SelectorLink","parentSelectors":["_root","pagination"],"selector":"a.next_page","multiple":true,"delay":0},{"id":"data-row","type":"SelectorElement","parentSelectors":["_root","pagination"],"selector":"tbody tr","multiple":true,"delay":0},{"id":"date","type":"SelectorText","parentSelectors":["data-row"],"selector":"td:nth-of-type(2)","multiple":false,"regex":"","delay":0},{"id":"value","type":"SelectorText","parentSelectors":["data-row"],"selector":"td:nth-of-type(3)","multiple":false,"regex":"","delay":0}]}
@FabianBeiner
FabianBeiner / recover-cla.md
Last active October 25, 2020 16:07
recover: Contributor Non-Exclusive License Agreement

Contributor Non-Exclusive License Agreement

Thank you for your interest in contributing to the “recover” project from Railslove GmbH (“We” or “Us”). The purpose of this contributor agreement (“Agreement”) is to clarify and document the rights granted by contributors to Us.

1. DEFINITIONS

“You” means the individual Copyright owner who submits a Contribution to Us. If You are an employee and submit the Contribution as part of your employment, You have had your employer approve this Agreement.

“Contribution” means any original work of authorship (software and/or documentation), including any modifications or additions to an existing work, Submitted by You to Us, in which You own the Copyright. If You do not own the Copyright in the authorship’s entire work, please contact Us at team@railslove.com.

“Copyright” means all rights protecting works of authorship owned or controlled by You, including copyright, moral and neighboring rights, as appropriate, for the full term

<?php
function testForExploit($strUrl = NULL) {
// I would love to use “filter_var($strLongUrl, FILTER_VALIDATE_URL)” here,
// but let us be honest, it sucks even more than regular expressions do.
// (http://snipplr.com/view/14198/useful-regex-functions/)
if (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $strUrl)) {
return false;
}
$oCurl = curl_init($strUrl);
curl_setopt_array($oCurl, array (CURLOPT_HTTPHEADER => array('Range: bytes=0-4')
@FabianBeiner
FabianBeiner / GoogleURLShortener.Example.php
Created January 11, 2011 10:03
A Google URL Shortener Class using the new API
<?php
// Examples!
require_once 'GoogleURLShortener.php';
// Shorten an URL.
$strLongUrl = 'http://www.github.com';
if ($strShortUrl = GoogleURLShortener::shorten($strLongUrl)) {
echo $strLongUrl . ' shortened: ' . $strShortUrl . '<br>';
}
@FabianBeiner
FabianBeiner / h1pmarker.bookmarklet.js
Created December 10, 2010 15:24
Mark <h[1-6]> & <p>
javascript:(function(){var%20e=["h1","h2","h3","h4","h5","h6","p"];for(var%20c%20in%20e){var%20d=document.body.getElementsByTagName(e[c]);if(d.length){for(var%20a=0;a<d.length;a++){var%20b=d[a].innerHTML;d[a].innerHTML='<span%20style="background-color:#ff0;color:#000;cursor:help;font-size:.8em;font-weight:700;padding:1px%204px%202px%203px;">'+e[c].toUpperCase()+"</span>&nbsp;"+b}}}})();