Skip to content

Instantly share code, notes, and snippets.

@velitasali
velitasali / Example.java
Last active September 23, 2023 19:33
Asynchronous & multithreaded TCP server/client example in Java
public static class Example {
public static void main(String[] argss) throws Exception {
int intStart = 6;
try (ServerSocket serverSocket = new ServerSocket()) {
serverSocket.bind(new InetSocketAddress(0));
Thread serverThread = new Thread(() -> {
try {
while (serverSocket.isBound()) {
@velitasali
velitasali / PKGBUILD
Created April 23, 2021 10:05
idevicerestore aur package with large timeout values
# Maintainer: Ivan Shapovalov <intelfx@intelfx.name>
# Contributor: Matthew Bauer <mjbauer95@gmail.com>
pkgname=idevicerestore
pkgver=1.0.1
pkgrel=1
pkgdesc="Restore/upgrade firmware of iOS devices"
arch=('i686' 'x86_64')
url="http://www.libimobiledevice.org"
license=('LGPL3')
@velitasali
velitasali / Vendor_0079_Product_0006.kl
Last active November 7, 2020 09:35
Keylayout for generic USB gamepads. To find the vendor and product number, run `lsusb` on a Linux machine while the gamepad is connected.
# /system/usr/keylayout/
# Generic USB Gamepad with XY ZRZ sticks
#
# `evtest` can help you discover the right bindings. Axis keys needs to start
# with axis and have the hexadecimal order of the key
key 288 BUTTON_X
key 289 BUTTON_A
key 290 BUTTON_B
key 291 BUTTON_Y
@velitasali
velitasali / termux.properties
Created July 12, 2020 10:02
A useful Termux key layout
extra-keys = [['ESC','CTRL','PGUP','HOME','UP','END'],['TAB','ALT','PGDOWN','LEFT','DOWN','RIGHT']]
@velitasali
velitasali / 82-cantarell.conf
Last active April 10, 2020 13:23
The config that provides the most designer intended look for the Cantarell font-family on Linux
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "../fonts.dtd">
<fontconfig>
<!-- First, we apply the general rules -->
<match target="font">
<test name="family" compare="eq" ignore-blanks="true">
<string>Cantarell</string>
</test>
<edit name="antialias" mode="assign">
<bool>true</bool>
@velitasali
velitasali / deamon.conf
Last active September 29, 2023 15:07
Static noise microphone issue with PulseAudio. On Linux, single channel mic inputs sometimes detected as stereo channel inputs. This causes static noise and unusable experience. To fix it, we need to route the left channel to a mono channel source. We also enable noise cancellation to remove fan and other hardware noises. For more information ht…
# /etc/pulse/
# This change is optional if you are not satisfied with sound quality. Please try different bitrate options and
# use the most compatible one. For instance, you may run "arecord -f dat -r 48000 -D hw:0,0 -d 5 test.wav" to
# record a sample audio. Change the bitrate accordingly by using "r" option.
default-sample-rate = 48000
alternate-sample-rate = 44100
@velitasali
velitasali / bt-agent.service
Last active June 23, 2024 07:41
Bluetooth NAP Network on RPi4 - package: bluez-utils
# /etc/systemd/system/bt-agent.service
[Unit]
Description=Bluetooth Auth Agent
[Service]
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
Type=simple
[Install]
@velitasali
velitasali / gnome-shell.css
Last active August 4, 2019 03:49
Fedora 30
/* This stylesheet is generated, DO NOT EDIT */
/* Copyright 2009, 2015 Red Hat, Inc.
*
* Portions adapted from Mx's data/style/default.css
* Copyright 2009 Intel Corporation
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 2.1, as published by the Free Software Foundation.
*
@velitasali
velitasali / 10-hinting-full.conf
Last active August 21, 2019 05:58
Ubuntu 19.04 GNOME Shell - My Customizations
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- this config file forces system full hinting-->
<!-- file: /etc/fonts/conf.d/10-hinting-full.conf -->
<fontconfig>
<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
<its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
</its:rules>
@velitasali
velitasali / upload.sh
Last active December 2, 2019 13:23
continuous deployment
#!/bin/bash
set +x # Do not leak information
# Exit immediately if one of the files given as arguments is not there
# because we don't want to delete the existing release if we don't have
# the new files that should be uploaded
for file in "$@"
do
if [ ! -e "$file" ]