Skip to content

Instantly share code, notes, and snippets.

View linuxoid69's full-sized avatar

Rustam linuxoid69

View GitHub Profile
@linuxoid69
linuxoid69 / autopgsqlbackup
Created April 22, 2016 13:19 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <[email protected]>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@linuxoid69
linuxoid69 / activemq.service
Created January 20, 2017 10:55
ActiveMQ service file for systemd
# cat activemq.service
[Unit]
Description=Apache ActiveMQ
After=network-online.target
[Service]
Type=forking
WorkingDirectory=/opt/activemq/bin
ExecStart=/opt/activemq/bin/activemq start
ExecStop=/opt/activemq/bin/activemq stop
@linuxoid69
linuxoid69 / ssl
Created April 23, 2017 19:20
ssl self-sign
# create CA key and cert
openssl genrsa -out rootCA.key 2048
openssl req -x509 -new -key rootCA.key -days 10000 -out rootCA.crt
# create host key, csr and sing host cert CA
openssl genrsa -out server101.mycloud.key 2048
openssl req -new -key server101.mycloud.key -out server101.mycloud.csr
openssl x509 -req -in server101.mycloud.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out server101.mycloud.crt -days 5000
@linuxoid69
linuxoid69 / server socket
Created June 17, 2017 18:25
server socket
#!/usr/bin/env python
import socket
from socket import AF_INET, SOCK_STREAM
HOST = '' # Symbolic name meaning all available interfaces
PORT = 50007 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((HOST, PORT))
s.listen(0)
@linuxoid69
linuxoid69 / client
Last active July 17, 2017 14:10
python activemq example
#!/usr/bin/env python
import time
import sys
import stomp
from stomp import *
conn = stomp.Connection()
conn.start()
conn.connect('admin', 'admin', wait=True)
@linuxoid69
linuxoid69 / 0_rpm.md
Created September 20, 2017 19:42 — forked from Driste/0_rpm.md
RPM

RPM: Red-Hat Package Manager

The basic procedure to build an RPM is as follows:

  • Get the source code you are building the RPM for to build on your system.
  • Make a patch of any changes you had to make to the sources to get them to build properly.
  • Make a spec file for the package.
  • Make sure everything is in its proper place.
  • Build the package using RPM.

The Spec file

@linuxoid69
linuxoid69 / sample.spec
Created September 20, 2017 19:44 — forked from schnell18/sample.spec
Template RPM spec file
Summary: The world famous foo
Name: foo
Version: 1.03
Release: 1
License: GPL
Group: Applications/System
Source0: foo-%{version}.tar.bz2
Source1: foo.sysvinit
Patch0: foo-fix1.patch
Patch1: foo-fix2.patch BuildRoot: /var/tmp/%{name}-root
@linuxoid69
linuxoid69 / githook_message
Last active April 26, 2024 10:24
githook_message
#!/bin/sh
set -ue
mkdir -p ~/.githook
echo '#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
@linuxoid69
linuxoid69 / docker_gui
Last active December 22, 2022 13:25
how run gui application in docker
$ docker run -e DISPLAY=unix$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix <image>
# sound
$ docker run --device=/dev/snd/controlC0 --device=/dev/snd/pcmC0D0p --device=/dev/snd/seq --device=/dev/snd/timer <image>
#on host machine
$ xhost +local:
@linuxoid69
linuxoid69 / 81-backlight.rules
Created May 19, 2019 08:48
81-backlight.rules
# Adjust screen brightness according to power state
# 1st rule for when on AC
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/YOUR_USERNAME/.Xauthority", RUN+="/usr/bin/brightlight -w 1200"
# 2nd rule for when on battery
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/YOUR_USERNAME/.Xauthority", RUN+="/usr/bin/brightlight -w 350"