Skip to content

Instantly share code, notes, and snippets.

@tszym
tszym / Nextcloud-Pi3-Setup.md
Created Feb 28, 2020 — forked from ronau/Nextcloud-Pi3-Setup.md
Nextcloud on Raspberry Pi 3 Setup
View Nextcloud-Pi3-Setup.md

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

View config-security
# 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 Jul 8, 2014
Twitter API - List my tweets
View list-my-tweets.php
<?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 Jul 7, 2014
Twitter API - Tweet data
View template.php
<!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 Aug 29, 2015
Twitter API - Account data
View account.php
<?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 Jul 7, 2014
Google Analytics API - Get sessions on time
View analytics.php
<?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 Jul 7, 2014
Google Analytics API - Authentication
View analytics.php
<?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 Jul 7, 2014
Youtube Data API v3 - Search videos
View youtube-search.php
<?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 Jul 7, 2014
Youtube Data API v3 - Get my favorites videos
View youtube-favorite-videos.php
<?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 Aug 29, 2015
Youtube Data API v3 - Get my uploaded videos
View youtube-my-videos.php
<?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.