Skip to content

Instantly share code, notes, and snippets.

View PeterTheOne's full-sized avatar

Peter Grassberger PeterTheOne

View GitHub Profile
@PeterTheOne
PeterTheOne / AccountController.php
Created July 17, 2012 12:01
Persist a TYPO3.Form to my own domain model by extending RedirectFinisher
/**
* Shows a form for creating a new account object
*
* @return void
*/
public function newAction() {
}
/**
* Adds the given new account object to the account repository
@PeterTheOne
PeterTheOne / ..._eID.php
Created May 15, 2013 16:05
How to Execute a scheduler task via an ajax request to an eID in typo3... TYPO3 version 4.5.16
<?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
$GLOBALS['TSFE']->fe_user = tslib_eidtools::initFeUser();
tslib_eidtools::connectDB();
if(t3lib_div::_POST('wsproductlist') || t3lib_div::_GET('wsproductlist')){

A joint work between Quinn Norton and Alexandre Dulaunoy on how to interact with journalists. The presentation was given at OHM2013.

Talking to the media

You've reached out, or they've reached out to you. It could be everything from a formal request to PR to someone who sat down beside you in a bar. It could be a 30 second breaking news piece, or a book 10 years in the making. Knowing a little bit about the media can make the whole exchange more fruitful and useful not only for you and the journalist, but a public that hasn't had a lot of good information about our world.

Inform yourself

@PeterTheOne
PeterTheOne / script.js
Last active December 24, 2015 04:29
Brute force mistyped GPG passwords. script.js creates a list of possible passwords by scrambling a string by switching the positions of two neighboring characters, script.sh tries them.
// http://stackoverflow.com/a/1431113/782920
String.prototype.replaceAt=function(index, character) {
return this.substr(0, index) + character + this.substr(index + character.length);
}
function scramble(text) {
var result = text + '\n';
for (var i = 0; i < text.length -1; i++) {
var temp = text;
temp = temp.replaceAt(i, text.charAt(i + 1));
temp = temp.replaceAt(i + 1, text.charAt(i));
@PeterTheOne
PeterTheOne / index.html
Created June 24, 2014 11:02
Check if time between interval in some timezone. Dependent upon Moment.js and Moment Timezone
<span class="status">loading</span>
@PeterTheOne
PeterTheOne / index.html
Last active August 29, 2015 14:03
Style links by hreflang depending on the site lang. Inspired by http://lachy.id.au/log/2005/04/handy-css#language
<!doctype html>
<html lang="en"><!-- or "de" -->
<head>
<meta charset="utf-8" />
<title>Style links by hreflang</title>
</head>
<body>
<!-- this link will have "de" appended -->
<a href="http://petergrassberger.at/" hreflang="de">German Site</a>
<!-- this link will stay the same because the site lang is "en" -->
@PeterTheOne
PeterTheOne / news-date-range.ts
Last active August 29, 2015 14:03
TYPO3 News filter by date range with timeRestriction and timeRestrictionHigh
temp.news = USER
temp.news {
userFunc = tx_extbase_core_bootstrap->run
extensionName = News
pluginName = Pi1
switchableControllerActions.News.1 = list
settings < plugin.tx_news.settings
view {
templateRootPath = fileadmin/templates/News/Templates/
partialRootPath = fileadmin/templates/News/Partials/
module.exports = function (creep) {
if(creep.energy == 0) {
creep.moveTo(Game.spawns.Spawn1);
Game.spawns.Spawn1.transferEnergy(creep);
}
else {
var targets = creep.room.find(Game.CONSTRUCTION_SITES);
if(targets.length) {
creep.moveTo(targets[0]);
creep.build(targets[0]);
@PeterTheOne
PeterTheOne / split.sh
Last active August 29, 2015 14:18
split bawag-psk bank pdfs
#!/bin/bash
cd Kontoauszuege/
for directory in */ ; do
echo "$directory"
cd ${directory}
for file in *.pdf ; do
# echo "$file to ../../Kontoauszuege_single/$directory$file"
pdftk ${file} burst output ../../Kontoauszuege_1pagers/${directory}${file}_pg_%04d.pdf
done
cd ..

Keybase proof

I hereby claim:

  • I am petertheone on github.
  • I am petertheone (https://keybase.io/petertheone) on keybase.
  • I have a public key whose fingerprint is 1DCC C325 2E43 8859 5288 63B4 4F6A CE90 B5F4 D176

To claim this, I am signing this object: