Skip to content

Instantly share code, notes, and snippets.

View clevertonh's full-sized avatar
🎯
Concentrando

Cléverton Heming clevertonh

🎯
Concentrando
View GitHub Profile
@clevertonh
clevertonh / sendToHA.js
Created November 30, 2022 17:09 — forked from bfritscher/sendToHA.js
node.js script to upload external data to home assistant via the websocket api
const W3CWebSocket = require("websocket").w3cwebsocket; // npm install websocket
const host = "127.0.0.1";
const port = 8123;
const protocol = "ws"; // ws or wss if ssl
// long lived access token from profile > Create Token
const access_token ="";
const entityName = "Energy Consumption";
const entityId = "energy_consumption_kwh";
@clevertonh
clevertonh / virtualbox.md
Created October 10, 2022 19:18 — forked from dominicsayers/virtualbox.md
Installing Virtualbox 4.3 on Ubuntu Server 13.10 64-bit

First install Virtualbox

  1. sudo pico /etc/apt/sources.list.d/virtualbox.list
  2. Add deb http://download.virtualbox.org/virtualbox/debian saucy contrib non-free
  3. wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
  4. sudo apt-get update
  5. sudo apt-get install dkms unzip
  6. sudo apt-get install virtualbox-4.3 --no-install-recommends
  7. wget http://download.virtualbox.org/virtualbox/4.3.6/Oracle_VM_VirtualBox_Extension_Pack-4.3.6.vbox-extpack
  8. sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.6.vbox-extpack
@clevertonh
clevertonh / answerfile
Created October 5, 2022 19:06 — forked from oofnikj/answerfile
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"
@clevertonh
clevertonh / mysql-optimize-innodb.sh
Created June 22, 2022 14:03 — forked from dkrnl/mysql-optimize-innodb.sh
mysql optimize innodb
#!/bin/sh
set -x
for i in `mysql --batch --execute 'SELECT CONCAT("\`", REPLACE(table_schema, "\`", "\`\`"), "\`.\`", REPLACE(table_name, "\`", "\`\`"), "\`") as \`mysql.db\` FROM information_schema.tables where ENGINE="MyISAM" and table_schema!="information_schema"'`; do mysql --execute "OPTIMIZE NO_WRITE_TO_BINLOG table $i;"; done
for i in `mysql --batch --execute 'SELECT CONCAT("\`", REPLACE(table_schema, "\`", "\`\`"), "\`.\`", REPLACE(table_name, "\`", "\`\`"), "\`") as \`mysql.db\` FROM information_schema.tables where ENGINE="InnoDB" and table_schema!="information_schema"'`; do mysql --execute "ALTER TABLE $i ENGINE=InnoDB; ANALYZE NO_WRITE_TO_BINLOG TABLE $i;"; done
mysql --execute 'PURGE BINARY LOGS BEFORE NOW();'
mysql --execute 'FLUSH TABLES;'
@clevertonh
clevertonh / mysql.sh
Created June 22, 2022 14:01 — forked from aktau/mysql.sh
Handy mysql commands and tips
#!/bin/sh
set -e
set -u
# I'm just getting acquainted with mysql so cut me some slack ;)
## check the size of the db
# source: http://stackoverflow.com/questions/1733507/how-to-get-size-of-mysql-database
# per schema
@clevertonh
clevertonh / tutorial.txt
Created March 28, 2022 23:30 — forked from luizomf/tutorial.txt
WSL2 e Docker no Windows 10.
### Tutorial oficial:
https://docs.microsoft.com/en-us/windows/wsl/install-win10
### Passo 1 (PowerShell Admin):
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
### Passo 2 (PowerShell Admin):
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
### Passo 3
@clevertonh
clevertonh / es_backup.sh
Created October 8, 2021 17:32 — forked from ctgswallow/es_backup.sh
Elasticsearch backup script
#!/bin/bash
################################################################
##### script to backup lucene index from elastic search ####
################################################################
# Shamelessly copied from https://gist.github.com/nherment/1939828
NOW=`date +%Y%m%d%H%M%S`
@clevertonh
clevertonh / ssh_into_android.md
Created July 26, 2021 15:20 — forked from raveenb/ssh_into_android.md
SSH into Android

Connecting to an Android device over SSH

Initial Setup

Install Android App Termux from APKPure or AppStore. If the app exists, just delete and re-install it to get the latest version, The APK can be downloaded from https://apkpure.com/termux/com.termux/ Install the APK using by running

adb install ~/Downloads/Termux_v0.73_apkpure.com.apk
@clevertonh
clevertonh / cap-first.sql
Created May 20, 2021 18:15 — forked from silasrm/cap-first.sql
Função para MySQL para mudar a caixa do texto para Título (CamelCase) Ref: http://joezack.com/2008/10/20/mysql-capitalize-function/
DELIMITER $$
CREATE FUNCTION CAP_FIRST (input VARCHAR(255))
RETURNS VARCHAR(255)
DETERMINISTIC
BEGIN
DECLARE len INT;
DECLARE i INT;
@clevertonh
clevertonh / index.html
Created February 4, 2021 14:44 — forked from arisetyo/index.html
Dynamic Real-time Chart Using Chart.js, Socket.io, and Knockout.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Galenic">
<script src="js/jquery-1.9.1.js"></script>
<script src="js/knockout-2.1.0.js"></script>
<script src="js/Chart.js"></script>
<link rel="stylesheet" href="pure-min.css">