Skip to content

Instantly share code, notes, and snippets.

# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
@bugsysop
bugsysop / from.php
Created August 8, 2016 05:34 — forked from judbd/from.php
<?php
/*
CREDITS & LICENCE
------------------------------------------------------------------------------------------------------------------------------
Made by Julien Dubedout / judbd.com
Released under Do What the Fuck You Want to Public License. https://en.wikipedia.org/wiki/WTFPL
PURPOSE
------------------------------------------------------------------------------------------------------------------------------
@bugsysop
bugsysop / translations.php
Created July 16, 2016 06:57
Translation file for the "pagelock" Kirby CMS plugin - https://github.com/pedroborges/kirby-pagelock
<?php
return [
"de" => [
"editing" => "<strong>%s</strong> bearbeitet diese Seite gerade.",
"stay" => "Sie werden auf dieser Seite benachrichtigt sobald die Bearbeitung wieder möglich ist.",
],
"en" => [
"editing" => "<strong>%s</strong> is editing this page.",
"stay" => "Stay here to be notified when it's your turn.",
@bugsysop
bugsysop / PrivateTorrent.md
Created March 28, 2016 15:16 — forked from sourcec0de/PrivateTorrent.md
Host a private torrent tracker, and seed a torrent on ubuntu 12.10

Install dep, and start tracker

sudo apt-get install bittornado ctorrent
bttrack --port 6969 --dfile ~/.bttrack/dstate --logfile ~/.bttrack/tracker.log --nat_check 0 --scrape_allowed full

Now, create a torrent file

ctorrent -t -u "YOUR_SERVER_IP:6969/announce" -s new_file_name.torrent file_or_folder_for_torrent
@bugsysop
bugsysop / Pure JavaScript Flickr gallery.markdown
Created October 22, 2015 06:17
Pure JavaScript Flickr gallery
<?php
/* Merge multiple RSS feeds with SimplePie
*
* Just modify the path to SimplePie and
* modify the $feeds array with the feeds you want
*
* You should probably also change the channel title, link and description,
* plus I added a CC license you may not want
*
* Help from: http://www.webmaster-source.com/2007/08/06/merging-rss-feeds-with-simplepie/
#!/bin/bash
# Takes one parameter: a remote git repository URL.
#
# This is the stuff this script does:
#
# 1. Clones the repository
# 2. Fetches all remote branches
# 3. Compresses the folder
# 4. Deletes the cloned folder.
@bugsysop
bugsysop / kirby-first-paragraph.php
Last active August 29, 2015 14:05
Kirby - Extract the first paragraph from an article
<?php
//If you want to remove the paragraph tags from the resulting string, uncomment the second line of the function.
function getFirstPara($string){
$string = substr($string,0, strpos($string, "</p>")+4);
//$string = str_replace("<p>", "", str_replace("<p/>", "", $string));
return $string;
}
$text = getFirstPara(kirbytext($page->text())); ?>
?>
@bugsysop
bugsysop / kirby-statify.php
Last active March 19, 2017 03:15 — forked from bastianallgeier/statify.php
A first draft for a script, which converts a Kirby site into a static site. It's a rough first draft, so don't expect it to be perfect. Play with it, if you like it!
<?php
/**
* Instructions:
*
* 1. Put this into the document root of your Kirby site
* 2. Make sure to setup the base url for your site correctly
* 3. Run this script with `php statify.php` or open it in your browser
* 4. Upload all files and folders from static to your server
* 5. Test your site
@bugsysop
bugsysop / longpost.php
Last active August 29, 2015 13:56 — forked from texnixe/longpost.php
Template for Kirby CMS that splits long post into several pages
<?php
// Source and documentation : http://www.texniq.de/en/kirby-wiki/split-long-posts-into-pages
// store the content of the kirbytext text variable in $text
$text = kirbytext($page->text());
// split the content of $text whenever a <!--pagebreak--> code is encountered and store in the array $pages
$pages = explode('<!--pagebreak-->', $text);