Skip to content

Instantly share code, notes, and snippets.

View danielcosta's full-sized avatar

Daniel Costa danielcosta

View GitHub Profile
@danielcosta
danielcosta / fix-mic-volume.md
Created June 30, 2022 15:31
Microphone settings for Linux

Fix Microphone Volume - or stop it from auto-adjustment

Check current volume

To see the current volume, run alsamixer. Let's consider the current volume shown is 40.

How to determine the .conf file for your microphone

Run pacmd list-sources.

@danielcosta
danielcosta / lint-php.sh
Last active July 19, 2017 14:31
Lint changed PHP files
#!/usr/bin/env bash
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
ANCESTOR=$(git merge-base $CURRENT_BRANCH master)
OIFS=$IFS
IFS=$'\n' FILES=($(git diff --name-status $ANCESTOR HEAD | grep -E '^[AM].+\.php$' | awk '{print $2}'))
IFS=$OIFS
php-lint.sh "${FILES[@]}"
@danielcosta
danielcosta / install-teamviewer.sh
Created July 10, 2017 14:23
Install Teamviewer on Debian
sudo dpkg --add-architecture i386
sudo apt update
cd ~/Downloads
curl -L -o teamviewer_i386.deb "https://download.teamviewer.com/download/teamviewer_i386.deb"
sudo apt install -y ./teamviewer_i386.deb
rm teamviewer_i386.deb
@danielcosta
danielcosta / updateJetbrains.sh
Last active April 30, 2020 02:38
Script to update PhpStorm and others Jetbrains products
#!/usr/bin/env bash
VERSION_PATTERN="([0-9]+\.[0-9]+\.[0-9]+)"
case "${1}" in
"phpstorm")
TOOL_NAME="PhpStorm"
INSTALL_DIR="/opt/phpstorm"
case "${2}" in
"eap")
@danielcosta
danielcosta / docker-compose.sh
Created April 7, 2017 15:18
Run docker-compose inside a container
#!/bin/bash
#
# Run docker-compose in a container
#
# This script will attempt to mirror the host paths by using volumes for the
# following paths:
# * $(pwd)
# * $(dirname $COMPOSE_FILE) if it's set
# * $HOME if it's set
#
@danielcosta
danielcosta / Dockerfile.php-5.5
Last active September 18, 2021 03:17
Compile memcache on alpine container for PHP 5.5 and 5.6
# php-5.5
FROM daccbr/php:5.5-fpm-alpine
RUN addgroup -g 1000 sumup && adduser -u 1000 -h /home/sumup -H -G sumup -s /bin/false -D sumup
RUN apk --update add openssh-client libtool make grep autoconf gcc libc-dev zlib-dev
RUN cd /tmp \
&& apk --update add cyrus-sasl-dev libmemcached-dev \
&& curl -L --progress-bar -o "php-memcached-2.2.0.tar.gz" "https://github.com/php-memcached-dev/php-memcached/archive/2.2.0.tar.gz" \
@danielcosta
danielcosta / ProtectedMethodTest.php
Created September 25, 2015 16:22
If you really need to test a protected class...
<?php
class ProtectedMethodTest extends PHPUnit_Framework_TestCase
{
public function testProtectedMethod()
{
$method = self::getMethod(
'MyClass',
'getProtectedMethodReturnsTrue'
);
2015-02-03 10:23:36 -0200
/usr/local/opt/php56/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
#!/bin/bash
# POMODORO
# usage: pomo | pomo short | pomo long
SLEEPTIME=1500
TITLE="POMODOR0 :)"
SUBTITLE="Take a Break :)"
if [ "$1" = "long" ]; then
@danielcosta
danielcosta / post-merge
Created September 17, 2014 17:41
post-merge hook for bob/alice (mobly)
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` or `git merge` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"