Skip to content

Instantly share code, notes, and snippets.

View Prototype-X's full-sized avatar

Maxim Prototype-X

View GitHub Profile
@Prototype-X
Prototype-X / upgrade-postgres-9.5-to-9.6.md
Last active January 14, 2021 20:03 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main

Set db path for pg_upgradecluster:

@Prototype-X
Prototype-X / Install_pgAdmin4_with_python3_on_Ubuntu 16.04.md
Last active January 30, 2022 23:24
Install pgAdmin4 v2.0 with python3 on Ubuntu 16.04 DESKTOP mode

Install pgAdmin4 v2.0 with python3 on Ubuntu 16.04 DESKTOP mode

  1. Get Python Wheel pgAdmin4

     wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.0/pip/pgadmin4-2.0-py2.py3-none-any.whl
    
  2. Install pip3

     sudo apt install python3-pip
    
@Prototype-X
Prototype-X / rpi_stress.sh
Last active December 1, 2019 18:47 — forked from sharipov-ru/rpi_stress.sh
Simple raspberry pi stress testing script
#!/bin/bash
while :
do
echo "$(date) @ $(hostname)"
echo "Performing new stress testing cycle..."
stress --cpu 20 --io 20 --vm 6 --vm-bytes 25M --timeout 120s
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "-------------------------------------------"
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
@Prototype-X
Prototype-X / cpustatus.sh
Created March 27, 2017 11:46 — forked from ecampidoglio/cpustatus.sh
A Bash script that prints the current state of the CPU on a Raspberry Pi. It displays variables like temperature, voltage and speed.
#!/bin/bash
# cpustatus
#
# Prints the current state of the CPU like temperature, voltage and speed.
# The temperature is reported in degrees Celsius (C) while
# the CPU speed is calculated in megahertz (MHz).
function convert_to_MHz {
let value=$1/1000
echo "$value"
#!/bin/bash
cpu=$(</sys/class/thermal/thermal_zone0/temp)
echo "GPU => $(/opt/vc/bin/vcgencmd measure_temp)"
echo "CPU => $((cpu/1000))'C"
@Prototype-X
Prototype-X / README-setup-systemd-timer.md
Last active April 22, 2018 09:58 — forked from drmalex07/README-setup-systemd-timer.md
An example systemd timer. #systemd #timer #systemd.timer #cron #cronjob

README

Timers provided by systemd can be used as cronjob replacements. More at man systemd.timer.

Suppose we want to periodically trigger cleanup tasks for a baz utility. We 'll create a baz-cleanup.service which will be triggered by a baz-cleanup.timer.

Define the target service unit

Create a minimal service at /lib/systemd/system/baz-cleanup.service:

@Prototype-X
Prototype-X / UFW-access-tftp-server.md
Last active April 25, 2017 10:30
UFW and tftp-server
@Prototype-X
Prototype-X / rdns.py
Created May 16, 2017 12:14 — forked from pklaus/rdns.py
This is a Python script that helps you create reverse DNS zone files for the Bind Name Server. See http://goo.gl/CJwly
#!/usr/bin/env python
"""
rdns.py
This is a Python script that helps you create
reverse DNS zone files for the Bind Name Server.
I published it together with this blog post: http://goo.gl/CJwly .
"""
@Prototype-X
Prototype-X / bash-cheatsheet.sh
Created May 21, 2017 13:54 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@Prototype-X
Prototype-X / postgres-cheatsheet.md
Created June 19, 2017 07:46 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*