Skip to content

Instantly share code, notes, and snippets.

@BarbUk
BarbUk / copyq
Last active December 14, 2023 19:52
Albert (https://github.com/albertlauncher/albert) external plugin to for copyq integration
#!/bin/bash
copyq_get_row(){
local copyq_row="$(copyq read $1 | head -1 | sed -e 's/^[[:space:]]*//')"
# clean from non compatible json char
printf -v clean_copyq_row "%q" "$copyq_row"
echo -n "$clean_copyq_row"
}
@jeffcogswell
jeffcogswell / org_ally1_bus_fix.md
Last active May 30, 2024 08:49
Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus ...

Seeing this error in the bash shell when launching some apps, such as scite:

** (scite:5298): WARNING **: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files

Update as per comments below.

It appears adding this library fixes the problem: at-spi2-core

@fffaraz
fffaraz / qt-unix-signals.md
Created May 22, 2017 21:36 — forked from azadkuh/qt-unix-signals.md
Catch Unix signals in Qt applications

Unix signals in Qt applications

It's quite easy to catch unix signals in Qt applications. you may like to ignore or accept them.

#include <QCoreApplication>

#include <signal.h>
#include <unistd.h>
(require 'dash)
(require 's)
(require 'loop)
(require 'icons-in-terminal)
(defun my-char-at-point (&optional p)
"P."
(let ((point (or p (point))))
(if (< point (point-max)) (buffer-substring-no-properties point (1+ point))
"")))
@giraldeau
giraldeau / CMakeLists.txt
Created November 3, 2017 21:48
The missing example to use cmake qt5_create_translation
cmake_minimum_required(VERSION 3.8)
project(tsProject)
# Managing translations require LinguistTools module
# The cmake function is defined in the Qt installation tree:
# i.e. Qt5.9.1/5.9.1/gcc_64/lib/cmake/Qt5LinguistTools/Qt5LinguistToolsMacros.cmake
# Reference: https://doc.qt.io/qt-5/cmake-manual.html#qt5linguisttools-macros
find_package(Qt5 COMPONENTS Widgets LinguistTools)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
@vladwa
vladwa / SSH.py
Created December 31, 2017 07:30
Python code to execute command as a sudo user over ssh connection on a remote server using "paramiko" module. On The code snippet establishes connection and executes the command and return the status and output of the executed command.
import logging
import paramiko
class SSH:
def __init__(self):
pass
def get_ssh_connection(self, ssh_machine, ssh_username, ssh_password):
"""Establishes a ssh connection to execute command.
:param ssh_machine: IP of the machine to which SSH connection to be established.
@huytd
huytd / customize.material-dark-theme.md
Last active September 2, 2023 13:03
My minimal Emacs config

;; Automatically generated
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(anzu-cons-mode-line-p nil)
@Alabate
Alabate / rosbridge_watcher.py
Created May 1, 2019 19:01
rosbridge watcher
#!/usr/bin/env python3
import rospy
import urllib.request
import urllib.error
import socket
import os
# This is not a param to avoid param injection
# or unexpected programm killed because of a simple rosparam set with a wrong value
@m-radzikowski
m-radzikowski / script-template.sh
Last active May 4, 2024 04:13
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]