Skip to content

Instantly share code, notes, and snippets.

View atlance's full-sized avatar

Anton Stepanov atlance

  • Saint Petersburg
View GitHub Profile
@atlance
atlance / connect_bluetooth_headphones.sh
Created October 1, 2021 23:25 — forked from egelev/connect_bluetooth_headphones.sh
Connect bluetooth headphones on Ubuntu 18.04
#!/usr/bin/env bash
function get_headphones_index() {
echo $(pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}')
}
function get_headphones_mac_address() {
local temp=$(pacmd list-cards | grep bluez_card -C20 | grep 'device.string' | cut -d' ' -f 3)
temp="${temp%\"}"
temp="${temp#\"}"
@atlance
atlance / myservice
Created February 19, 2020 10:13 — forked from bramus/myservice
Running a PHP script as a service/daemon using `start-stop-daemon`
#! /bin/sh
# Installation
# - Move this to /etc/init.d/myservice
# - chmod +x this
#
# Starting and stopping
# - Start: `service myservice start` or `/etc/init.d/myservice start`
# - Stop: `service myservice stop` or `/etc/init.d/myservice stop`
@atlance
atlance / 60-jetbrains.conf
Created December 10, 2019 07:48 — forked from bittner/60-jetbrains.conf
Inotify configuration for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm). Create this file with e.g. `sudo vim /etc/sysctl.d/60-jetbrains.conf`
# Set inotify watch limit high enough for IntelliJ IDEA (PhpStorm, PyCharm, RubyMine, WebStorm).
# Create this file as /etc/sysctl.d/60-jetbrains.conf (Debian, Ubuntu), and
# run `sudo service procps start` or reboot.
# Source: https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
#
# More information resources:
# -$ man inotify # manpage
# -$ man sysctl.conf # manpage
# -$ cat /proc/sys/fs/inotify/max_user_watches # print current value in use
@atlance
atlance / HotsiteListener.php
Created November 7, 2019 16:01 — forked from raphox/HotsiteListener.php
Symfony script to create dynamic routes to hotsite or subdomains #php #subdomain #routes #dynamic
<?php
namespace Acme\HotsiteBundle\EventListener;
use Acme\HotsiteBundle\Controller\HotsiteSignedController;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\RedirectResponse;
@atlance
atlance / repo-full-copy.sh
Created November 20, 2017 07:15 — forked from AgiosAndreas/repo-full-copy.sh
Полный перенос git репозитория на другой сервер
# Клонируем исходный репозиторий без рабочего каталога (--bare)
git clone --bare https://github.com/exampleuser/old-repository.git
cd old-repository.git
# Делаем mirror-push(будут скопированы все ветки и тэги) в новый репозиторий
git push --mirror https://github.com/exampleuser/new-repository.git
cd ..
# Удаляем папку с репозиторием
@atlance
atlance / 1_Result.php
Created August 15, 2017 10:11 — forked from cystbear/1_Result.php
Custom annotations in Symfony2 (http://habrahabr.ru/blogs/symfony/133270/)
<?php
class DefaultController extends Controller
{
/**
* Dashboard page.
* @Permissions(perm="dashboard_view")
* @Route("/", name="ITEDashboardBundle_index")
* @Template()
* @return array