Skip to content

Instantly share code, notes, and snippets.

View LukasReschke's full-sized avatar

Lukas Reschke LukasReschke

View GitHub Profile
@LukasReschke
LukasReschke / fizzbuzz.go
Created August 5, 2012 17:42
FizzBuzz in Golang
package main
import "fmt"
func main() {
for i := 1; i < 101; i++ {
switch {
case i%15 == 0:
fmt.Println("FizzBuzz")
case i%3 == 0:
@LukasReschke
LukasReschke / mp3_convert.sh
Created August 31, 2012 14:06
Converts all mp3 files in a directory to 128kbit/s if necessary
#!/bin/bash
# Requirements: ffmpeg, mp3info
# Do a "mkdir output" before execution
for f in *.mp3; do
if [ "$(mp3info -r m -p %r "$f")" -ge 128 ]; then
ffmpeg -y -i "$f" -ab 128k "output/${f%.mp3}.mp3"
else
cp "$f" "output/$f"
fi; done
@LukasReschke
LukasReschke / appinfo\VERSION
Created June 23, 2013 15:17
Load a JS file in ownCloud for not logged-in users
1.0
<?php
// The libxml entity loader is disabled by default
// even setting the libxml_disable_entity_loader to false doesn't works!
//
// @see http://uk3.php.net/manual/en/function.libxml-disable-entity-loader.php
// @see http://stackoverflow.com/a/10213239
$dir = __DIR__;
$content = 'This is a remote content!';
file_put_contents('content.txt', $content);

Keybase proof

I hereby claim:

  • I am lukasreschke on github.
  • I am lukasreschke (https://keybase.io/lukasreschke) on keybase.
  • I have a public key whose fingerprint is 4E16 FFDA 9CCF 3FF9 EFBF 8E0A 9F57 5ED9 23EB F2BD

To claim this, I am signing this object:

@LukasReschke
LukasReschke / pagecontroller.php
Created June 26, 2014 19:03
pagecontroller.php
<?php
/**
* ownCloud - passman
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Sander Brand <[email protected]>
* @copyright Sander Brand 2014
*/
language: php
php:
- 5.3
- 5.4
- 5.5
- 5.6
env:
global:
- CORE_BRANCH=master
<?php
/**
* ownCloud
*
* @author Frank Karlitschek
* @copyright 2010 Frank Karlitschek [email protected]
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
<?php
require_once('./lib/base.php');
use Sabre\DAV\Client;
$settings = [
'baseUri' => 'http://localhost/master/remote.php/webdav/',
'userName' => 'admin',
'password' => 'admin',
@LukasReschke
LukasReschke / move.php
Created October 15, 2015 21:25
How to move a folder in ownCloud using the Node API
<?php
require_once './lib/base.php';
$rootFolder = \OC::$server->getRootFolder();
$folderToMove = $rootFolder->get('/admin/files/folderToMove');
$folderToMove->move('/admin/files/NewPath');