Skip to content

Instantly share code, notes, and snippets.

View pavel-trubitsyn's full-sized avatar
:shipit:
I may be slow to respond.

Pavel Trubitsyn pavel-trubitsyn

:shipit:
I may be slow to respond.
View GitHub Profile
@wadimw
wadimw / adaptMonitorBrightness-M27Q.py
Last active April 16, 2025 06:07
Python script for MacOS which changes brightness of Gigabyte M27Q KVM Monitor to match current brightness of builtin MacBook Pro display; this is instead of Lunar app, because DDC/CI commands do not work for me over USB-C DisplayPort
#!/usr/local/bin/python3
# For Gigabyte M27Q KVM connected over USB-C
#
# Reads brightness value of builtin display from system, adapts it (Lunar-style) and sends over USB command to external display
#
# You need PyUSB and PyObjC
#
# Not much testing was done so far, only on MBP A1990 15" 2019 i7 555X
#
@qdm12
qdm12 / README.md
Last active March 20, 2025 08:49
Wireguard and iptables restrictions for multiple users

Wireguard and iptables restrictions for multiple users

If you don't know what Wireguard is, well, you should. It's fast, easy to setup and highly configurable. We will configure Wireguard for multiple users with various restrictions using iptables.

Assumptions

This should fit most setups (not mine though 😉)

@m1keil
m1keil / README.md
Last active February 12, 2025 14:17
Configure Kibana to use SAML with Google Workspace (Google Apps, G Suite)

The following worked with Elastic Cloud, Elasticsearch & Kibana v7.6.0. It should be pretty close for other kinds of deployments. Before starting, make sure you have the right license level that allows SAML.

Create SAML App in Google Workspace:

  • Navigate to the SAML apps section of the admin console
  • Click the Add button and choose to "Add custom SAML app"
  • Write down the Entity ID and download the Idp metadata file
  • Choose application name, description and add logo
  • In the "Service Provider Details" screen add the following:
@carceneaux
carceneaux / remove_gitlab_artifacts.sh
Last active March 29, 2025 22:48
Script for removing GitLab Job Artifacts.
#!/bin/bash
#
# Written by Chris Arceneaux
# GitHub: https://github.com/carceneaux
# Email: [email protected]
# Website: http://arsano.ninja
#
# Note: This code is a stop-gap to erase Job Artifacts for a project. I HIGHLY recommend you leverage
# "artifacts:expire_in" in your .gitlab-ci.yml
#
@dasgoll
dasgoll / EMR_cluster.template
Created August 3, 2017 08:15
EMR cluster cloudformation template
{
"Conditions": {
"WithSpotPrice": {
"Fn::Not": [
{
"Fn::Equals": [
{
"Ref": "SpotPrice"
},
"0"
@jgraglia
jgraglia / Jenkinsfile
Created July 11, 2017 10:38
Extended Choice Plugin in Jenkins pipeline
// YOU HAVE TO :
// 1. install the Extended Choice Parameter Plugin : https://wiki.jenkins.io/display/JENKINS/Extended+Choice+Parameter+plugin
// 2. Allow the instanciation of ExtendedChoiceParameterDefinition in you script approval admin page https://myjenkins/scriptApproval/
List params = []
List props = []
// https://github.com/jenkinsci/extended-choice-parameter-plugin/blob/master/src/main/java/com/cwctravel/hudson/plugins/extended_choice_parameter/ExtendedChoiceParameterDefinition.java#L427
// https://issues.jenkins-ci.org/browse/JENKINS-34617
[Unit]
Description=Mongo shard service
After=syslog.target
After=network.target
After=bind9.service
[Service]
Type=fork
PIDFile=/var/run/mongos.pid
User=mongodb
@yuasatakayuki
yuasatakayuki / esp01_oled_bme280.cpp
Created January 1, 2017 13:17
Arduino sketch for ESP-01 + OLED + BME280
#include <stdio.h>
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <BME280.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// WiFi configuration
const char* ssid = "WIFI_SSID";
const char* password = "WIFIT_PASSWORD";
@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@KKorvin
KKorvin / PickDominantColor.java
Last active August 3, 2021 16:07
How to pick dominant color from image on Android. Palette Google library used.
// Don't forget to add Palette library to your build.gradle
// compile 'com.android.support:palette-v7:+'
public static int getDominantColor(Bitmap bitmap) {
List<Palette.Swatch> swatchesTemp = Palette.from(bitmap).generate().getSwatches();
List<Palette.Swatch> swatches = new ArrayList<Palette.Swatch>(swatchesTemp);
Collections.sort(swatches, new Comparator<Palette.Swatch>() {
@Override
public int compare(Palette.Swatch swatch1, Palette.Swatch swatch2) {
return swatch2.getPopulation() - swatch1.getPopulation();