Skip to content

Instantly share code, notes, and snippets.

Rustam linuxoid69

Block or report user

Report or block linuxoid69

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 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"
@linuxoid69
linuxoid69 / docker_gui
Last active May 8, 2019
how run gui application in docker
View docker_gui
$ 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 / githook_message
Last active Oct 26, 2018
githook_message
View githook_message
#!/bin/sh
set -e
mkdir -p ~/.githook
set -n
echo '
#!/bin/bash
# This way you can customize which branches should be skipped when
@linuxoid69
linuxoid69 / sample.spec
Created Sep 20, 2017 — forked from schnell18/sample.spec
Template RPM spec file
View sample.spec
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
View 0_rpm.md

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 / client
Last active Jul 17, 2017
python activemq example
View client
#!/usr/bin/env python
import time
import sys
import stomp
from stomp import *
conn = stomp.Connection()
conn.start()
conn.connect('admin', 'admin', wait=True)
View 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 / ssl
Created Apr 23, 2017
ssl self-sign
View ssl
# 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 / activemq.service
Created Jan 20, 2017 — forked from varnav/activemq.service
ActiveMQ service file for systemd
View activemq.service
# 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 / autopgsqlbackup
Created Apr 22, 2016 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
View autopgsqlbackup
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# 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
You can’t perform that action at this time.