Skip to content

Instantly share code, notes, and snippets.

@Nilpo
Nilpo / INSTALL.md
Last active October 24, 2022 14:02
Instal Plex on Asus Tinker Board
  1. In terminal, upgrade TinkerOS.

    sudo apt update && apt upgrade -y
    sudo apt dist-upgrade
  2. Install avahi-daemon

@Nilpo
Nilpo / Raspberry Pi Plex Media Server.md
Last active June 26, 2019 05:12
Install Plex on Raspbian Stretch for Raspberry Pi 3
  1. In terminal, upgrade Raspbian.

    sudo apt update && sudo apt dist-upgrade -y
  2. Next, use the raspi-config tool to change some default system settings.

sudo raspi-config

@Nilpo
Nilpo / psql-with-gzip-cheatsheet.sh
Created February 4, 2018 09:16 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@Nilpo
Nilpo / gist:52eda0bf40fddec539aa4ac4bb0ecc2c
Created September 9, 2017 06:07 — forked from cdown/gist:1163649
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
from line import LineClient, LineGroup, LineContact, LineMessage
import os
import sys
import re
import ast
from curve.ttypes import OperationType, TalkException
try:
# client5 = LineClient("[email protected]", "321321Ab", authToken="EiLW77LqJc7usR6vB5z9.7x9TsSw19TOlLNYRF2HOUq.sCuQ9zBZ90djqjN0dkBubuPcT2WDi5mG5razGdrcrgI=", com_name="Aero5", is_mac=False)
# client5 = LineClient(os.environ['LINE_ULTRON_LOGIN'], os.environ['LINE_ULTRON_PASS'], com_name="Aero5", is_mac=False)
@Nilpo
Nilpo / flask-logging-on-heroku.py
Last active July 9, 2017 03:45 — forked from seanbehan/flask-logging-on-heroku.py
logging on heroku with flask
import os
import sys
import logging
from flask import Flask
app = Flask(__name__)
if 'DYNO' in os.environ:
app.logger.addHandler(logging.StreamHandler(sys.stdout))
app.logger.setLevel(logging.ERROR)
@Nilpo
Nilpo / proxy.apache.conf
Created June 26, 2017 01:23 — forked from chrisjhoughton/proxy.apache.conf
Sample Nginx reverse proxy to Apache set up for Wordpress.
<VirtualHost *:{PORT}>
ServerName www.yourdomain.com
ServerAdmin [email protected]
DocumentRoot /var/www/yourdir/
<Directory /var/www/yourdir>
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
//Add before making a phone call
if (ActivityCompat.checkSelfPermission(
MainActivity.this, Manifest.permission.CALL_PHONE)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(MainActivity.this,
Manifest.permission.CALL_PHONE)) {
Toast.makeText(MainActivity.this, "I know you said no, but I'm asking again", Toast.LENGTH_SHORT).show();
}
ActivityCompat.requestPermissions(MainActivity.this,
new String[]{Manifest.permission.CALL_PHONE},