Skip to content

Instantly share code, notes, and snippets.

@tszym
tszym / Nextcloud-Pi3-Setup.md
Created February 28, 2020 10:52 — forked from ronau/Nextcloud-Pi3-Setup.md
Nextcloud on Raspberry Pi 3 Setup

Nextcloud on Raspberry Pi 3 Setup

This manual describes how to setup a Raspberry Pi 3 with nginx, PHP 7.0, MariaDB and use it as a Nextcloud server. Strong TLS encryption with Let's Encrypt certificates is also used. Of course, Owncloud can be used instead of Nextcloud. As of February 2017, the installation instructions are basically the same.

Useful links and knowledge sources for this step-by-step manual

# vim: ft=sshconfig
# Sane security defaults for SSH clients. Disables everything old and nasty.
# Unfortunately, SSH appears to provide no way to *exclude* old protocols,
# so we have a list of known-secure key exchange algorithms, symmetric ciphers,
# and message authentication codes.
# Config taken from [https://stribika.github.io/2015/01/04/secure-secure-shell.html]
Host *
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
@tszym
tszym / list-my-tweets.php
Created July 8, 2014 09:56
Twitter API - List my tweets
<?php
/**
* @file
* User has successfully authenticated with Twitter. Access tokens saved to session and DB.
*/
/* Load required lib files. */
session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('config.php');
@tszym
tszym / template.php
Created July 7, 2014 16:09
Twitter API - Tweet data
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Twitter - Get tweet infos in PHP</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<style type="text/css">
img {border-width: 0}
* {font-family:'Lucida Grande', sans-serif;}
</style>
@tszym
tszym / account.php
Last active August 29, 2015 14:03
Twitter API - Account data
<?php
/**
* @file
* User has successfully authenticated with Twitter. Access tokens saved to session and DB.
*/
/* Load required lib files. */
session_start();
require_once('twitteroauth/twitteroauth.php');
require_once('config.php');
@tszym
tszym / analytics.php
Created July 7, 2014 11:38
Google Analytics API - Get sessions on time
<?php
// The first step is the authentication, in an other gist
// ...
function runDemo($analytics) {
try {
// Step 2. Get the user's first view (profile) ID.
$profileId = getFirstProfileId($analytics);
@tszym
tszym / analytics.php
Created July 7, 2014 09:58
Google Analytics API - Authentication
<?php
/**
* How to authenticate with OAuth2 by the Google API client
**/
$classLoader = require __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/../vendor/google/apiclient/src/Google/Client.php';
require_once __DIR__.'/../vendor/google/apiclient/src/Google/Service/Analytics.php';
@tszym
tszym / youtube-search.php
Created July 7, 2014 09:15
Youtube Data API v3 - Search videos
<?php
// ...
if ($client->getAccessToken()) {
// Create analytics service object.
$youtube = new Google_Service_YouTube($client);
try {
$keySearch = isset($_POST['key']) ? $_POST['key'] : '';
@tszym
tszym / youtube-favorite-videos.php
Created July 7, 2014 08:53
Youtube Data API v3 - Get my favorites videos
<?php
// ...
if ($client->getAccessToken()) {
// Create analytics service object.
$youtube = new Google_Service_YouTube($client);
/**
* Retrive favourites videos of the user
@tszym
tszym / youtube-my-videos.php
Last active August 29, 2015 14:03
Youtube Data API v3 - Get my uploaded videos
<?php
// ...
if ($client->getAccessToken()) {
// Create analytics service object.
$youtube = new Google_Service_YouTube($client);
try {
// Call the channels.list method to retrieve information about the
// currently authenticated user's channel.