Skip to content

Instantly share code, notes, and snippets.

View nielsonsantana's full-sized avatar

Nielson Santana nielsonsantana

View GitHub Profile
@nielsonsantana
nielsonsantana / gitprunelocalbranchs.sh
Last active June 27, 2021 14:40
Bash script to delete local git branches that aren't on git remote server
# Nielson Santana @nielsonsantana
# This code is under Criative Communs license [https://creativecommons.org/licenses/by/4.0/]
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@nielsonsantana
nielsonsantana / ath10k_pci - QCA6174.md
Last active August 26, 2020 19:51
[Solved] Ath10k and QCA6174 causing firmware crashes and connection lost

Problem

Ubuntu(kernel 5.x) presents the fallowing error using dmesg -w:

[103916.261609] ath10k_pci 0000:02:00.0: firmware crashed! (guid bf84d993-9ec2-4eb5-82db-2055687625cc)
[103916.261619] ath10k_pci 0000:02:00.0: qca6174 hw3.2 target 0x05030000 chip_id 0x00340aff sub 1028:0310
[103916.261623] ath10k_pci 0000:02:00.0: kconfig debug 0 debugfs 1 tracing 1 dfs 0 testmode 0
[103916.262515] ath10k_pci 0000:02:00.0: firmware ver WLAN.RM.4.4.1-00079-QCARMSWPZ-1 api 6 features wowlan,ignore-otp crc32 fd869beb
[103916.263208] ath10k_pci 0000:02:00.0: board_file api 2 bmi_id N/A crc32 4ac0889b
[103916.263212] ath10k_pci 0000:02:00.0: htt-ver 3.47 wmi-op 4 htt-op 3 cal otp max-sta 32 raw 0 hwcrypto 1

[103916.275666] ath10k_pci 0000:02:00.0: failed to get memcpy hi address for firmware address 4: -16

@nielsonsantana
nielsonsantana / bench.py
Created April 2, 2020 12:13
Benchmark of a recursive function that prevent data breach
import statistics
import collections
from timeit import default_timer as timer
from bench_data import DEFAULT_KEYS_TO_CLEAN
from bench_data import large_payload
from bench_data import small_payload
from bench_data import very_large_payload
@nielsonsantana
nielsonsantana / dropbox
Last active April 2, 2018 03:37 — forked from benhedrington/dropbox
Dropbox init.d
#!/bin/sh
# dropbox service
# Replace with linux users you want to run Dropbox clients for
DROPBOX_USERS="user1 user2"
DAEMON=.dropbox-dist/dropboxd
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
@nielsonsantana
nielsonsantana / docker-compose.yml
Created October 20, 2017 21:57
Docker Compose with dependences for tsuru pas
version: '2'
services:
planb:
container_name: tsuru_planb
image: "tsuru/planb"
network_mode: "host"
entrypoint: /bin/planb --listen :80
depends_on:
- redis
@nielsonsantana
nielsonsantana / dockerenter.sh
Last active July 5, 2022 13:35
Docker Shortcut to singin on docker container by name
#!/bin/bash
DOCKER_PS_LINE=`docker ps | awk '{print $1,$2,$NF}' | grep -m 1 $1`
CONTAINER_NAME=`echo $DOCKER_PS_LINE | awk '{print $2}'`
CONTAINER_ID=`echo $DOCKER_PS_LINE | awk '{print $1}'`
if [ -n "$CONTAINER_ID" ]; then
echo "Logged in: $CONTAINER_NAME"
docker exec -it $CONTAINER_ID bash
else
echo "No container found for query: '$1'"
@nielsonsantana
nielsonsantana / gist:6d7e2a172d532df8d7b6
Last active March 13, 2016 06:17
Dokku can't remove old images,
Description of problem:
The dokku can't remove old images, then my HD have a little space available.
Output of the following commands
- `uname -a`:
Linux genomika-dokku-staging 3.13.0-57-generic #95-Ubuntu SMP Fri Jun 19 09:28:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
@nielsonsantana
nielsonsantana / gist:623add98aa8e52076cbf
Created March 13, 2016 05:08
output after run 'DOKKU_TRACE=1 dokku cleanup'
+ [[ -f /home/dokku/dokkurc ]]
+ [[ -d /home/dokku/.dokkurc ]]
+ [[ -n 1 ]]
+ set -x
+ parse_args cleanup
+ for arg in '"$@"'
+ case "$arg" in
+ return 0
+ args=("$@")
+ [[ cleanup =~ ^--.* ]]
@nielsonsantana
nielsonsantana / install-comodo-ssl-cert-for-nginx.rst
Created March 6, 2016 17:42 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@nielsonsantana
nielsonsantana / redis.conf
Last active February 15, 2017 21:06 — forked from ehazlett/redis.conf
Redis supervisor config
[program:redis]
command=/usr/bin/redis-server /etc/redis/redis.conf
user=root
autostart=true
autorestart=true
stdout_logfile=/var/log/redis/stdout.log
stderr_logfile=/var/log/redis/stderr.log
stopsignal=QUIT