Skip to content

Instantly share code, notes, and snippets.

@micalm
micalm / pair-dual-boot-bluetooth.md
Created June 22, 2023 06:26 — forked from madkoding/pair-dual-boot-bluetooth.md
Pairing bluetooth devices (keyboard or mouse) in dual boot with Linux Ubuntu and Windows 10

1) Pair ALL bluetooth devices in linux (it is to have the files you will need to edit later)

2) Pair ALL bluetooth devices in Windows 10. If you know how, get the MAC address id from your bluethooth keyboard, we will need it later

3) Reboot and go back to Linux

4) Install chntpw package, this is needed to read the registry keys from Wintendo

sudo apt-get install chntpw
@micalm
micalm / docker-compose.yml
Created February 26, 2021 12:59
SonarQube Docker-Compose
version: "3"
services:
sonarqube:
image: sonarqube:8-community
depends_on:
- sentry-pgsql
environment:
SONAR_JDBC_URL: jdbc:postgresql://sentry-pgsql:5432/sonar
SONAR_JDBC_USERNAME: sonar
@micalm
micalm / encrypt.sh
Created October 10, 2018 08:47
Encrypt all files in current folder with passphrase
#!/usr/bin/env bash
PASS="$1"
CIPHER="AES256"
for filename in ./*; do
encoded="$filename.asc"
echo "Encoding $filename..."
@micalm
micalm / setup.sh
Last active May 2, 2018 06:45
Ubuntu 18.04 Setup Script
#!/usr/bin/env bash
# Prepare
sudo apt update
sudo apt upgrade
# Install basics
sudo apt install curl git vim zsh tmux wget htop
# Install and configure oh-my-zsh
@micalm
micalm / index.html
Created March 7, 2017 09:48 — forked from anonymous/index.html
SERP Preview
<h2>Metadata:</h2>
<label for="url">URL:</label>
<input type="url" name="url" id="url" onkeyup="setUrl();">
<br>
<label for="title">SEO Title:</label>
<input type="text" name="title" id="title" onkeyup="setTitle();">
<br>
<label for="title">Meta Description:</label>
<input type="text" name="description" id="description" onkeyup="setDescription();">
<br>
@micalm
micalm / colors.sh
Created February 5, 2017 15:37
Shell Color Escape Code Variables
BLACK='\033[0;30m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
LIGHTGRAY='\033[0;37m'
DARKGRAY='\033[1;30m'
LIGHTRED='\033[1;31m'
@micalm
micalm / .htaccess
Created January 16, 2017 12:00
Cache/GZIP/DEFLATE .htaccess rules
Header unset Pragma
FileETag None
Header unset ETag
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/jpeg "access plus 30 days"
@micalm
micalm / gist:eb58699a7d759625c5acfaa5455c4d16
Created December 20, 2016 08:45
Allow non-root program to run on ports < 1024
# Run as root or with sudo
$ sudo setcap 'cap_net_bind_service=+ep' /usr/bin/executable
@micalm
micalm / iptables-block-by-country.sh
Last active October 3, 2018 07:26
Block IPs by country
#!/bin/bash
# Purpose: Block all traffic from RUSSIA (ru) and BELARUS (by). Use ISO code. #
# See url for more info - http://www.cyberciti.biz/faq/?p=3402
# Author: nixCraft <www.cyberciti.biz> under GPL v.2.0+
# -------------------------------------------------------------------------------
ISO="ru by"
### Set PATH ###
IPT=/sbin/iptables
WGET=/usr/bin/wget
@micalm
micalm / xhrdl.js
Last active October 3, 2018 07:29
XHR Download file
$("#saveAndDownload").click(function() {
var invoiceData = getJsonData();
var xhr = new XMLHttpRequest();
xhr.open('PUT', 'SOME_URL', true);
xhr.responseType = 'arraybuffer';
xhr.setRequestHeader('X-CSRFToken', getCookie('csrftoken'));
xhr.send(JSON.stringify(invoiceData));
xhr.onload = function(e) {
var arr = new Uint8Array(this.response);
var raw = String.fromCharCode.apply(null,arr);