Skip to content

Instantly share code, notes, and snippets.

View linuxoid69's full-sized avatar
🏠
Working from home

Rustam linuxoid69

🏠
Working from home
View GitHub Profile
@linuxoid69
linuxoid69 / main.go
Last active June 29, 2023 22:11
simple prometheus exporter
package main
import (
"fmt"
"net/http"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
@linuxoid69
linuxoid69 / HttpProxy.go
Created January 18, 2023 18:38 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@linuxoid69
linuxoid69 / test2.yaml
Last active October 28, 2022 21:53
test2.yaml
default:
before_script:
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
- gem install bundler --no-document
- bundle install --jobs $(nproc) "${FLAGS[@]}"
@linuxoid69
linuxoid69 / test.yaml
Last active October 28, 2022 21:54
test.yaml
container_scanning:
stage: test
image:
name: docker.io/aquasec/trivy:latest
entrypoint: [""]
variables:
# No need to clone the repo, we exclusively work on artifacts. See
# https://docs.gitlab.com/ee/ci/runners/README.html#git-strategy
GIT_STRATEGY: none
TRIVY_USERNAME: "$CI_REGISTRY_USER"
@linuxoid69
linuxoid69 / main.go
Created December 28, 2021 20:22
web server with embed content
package main
import (
"embed"
"log"
"net/http"
)
//go:embed static/*
var content embed.FS
@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"
@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 / githook_message
Last active April 25, 2024 12:35
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 / 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 / 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