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 / 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"
@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 / 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 *.*

@Prototype-X
Prototype-X / tmux_vs_screen.md
Created September 21, 2017 20:52 — forked from P7h/tmux_vs_screen.md
tmux vs screen commands

tmux vs. screen commands


Action tmux screen
start a new session tmux
tmux new
tmux new-session
screen
start a new session with a name tmux new -s name screen -S name
re-attach a detached session tmux attach
tmux attach-session
screen -r
re-attach a detached session with a name tmux attach -t name
tmux a -t name
screen -r name
re-attach an attached session (detaching it from elsewhere) tmux attach -dtmux attach-session -d screen -dr
@Prototype-X
Prototype-X / mac-vendor.txt
Created November 19, 2017 12:25 — forked from aallan/mac-vendor.txt
List of MAC addresses with vendors identities
000000 Officially Xerox
000001 SuperLAN-2U
000002 BBN (was internal usage only, no longer used)
000003 XEROX CORPORATION
000004 XEROX CORPORATION
000005 XEROX CORPORATION
000006 XEROX CORPORATION
000007 XEROX CORPORATION
000008 XEROX CORPORATION
000009 powerpipes?
@Prototype-X
Prototype-X / gist:7852b196b95842d9581a482afdb1158b
Created February 6, 2018 08:11 — forked from mattm7n/gist:1405067
Monitor DHCP traffic with tcpdump
# Monitoring on interface eth0
tcpdump -i eth0 -n port 67 and port 68