Skip to content

Instantly share code, notes, and snippets.

View sthales's full-sized avatar
🏠
Working from home

Thales Silva sthales

🏠
Working from home
View GitHub Profile
@sthales
sthales / update-golang.md
Created July 27, 2021 12:43 — forked from nikhita/update-golang.md
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@sthales
sthales / Disable_Hibernate_mode
Created June 23, 2021 16:23 — forked from hariel18/Disable_Hibernate_mode
OSX: Disable Hibernate mode
#http://www.engadget.com/2011/08/22/why-hibernate-or-safe-sleep-mode-is-no-longer-necessary-in-os/
#https://www.idelta.info/archives/some-hidden-changes-in-os-x-el-capitan/
# disable hibernation
sudo pmset hibernatemode 0
# clear the image file
sudo rm -rf /var/vm/sleepimage
# inhibit file recreation
@sthales
sthales / NatualScrollingInWindows.ps1
Created August 15, 2020 13:26 — forked from 101v/NatualScrollingInWindows.ps1
Powershell script to enable natural scrolling in Windows
# View registry settings
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0
# Change registry settings
# Reverse mouse wheel scroll FlipFlopWheel = 1
# Normal mouse wheel scroll FlipFlopWheel = 0
Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
# Restore default scroll direction
# Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 1 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 0 }
async function validatePassword(password: string): string[] {
let errors = []
// 1. Don't regex for things you can trivially express in code
// -----------------------------------------------------------
// For example, we could have written this as `/^.{0,7}$/` but that's not
// nearly as clear as checking the length of the string.
if (password.length < 8) {
errors.push("Password must be at least 8 characters long")
@sthales
sthales / .zshrc
Created March 24, 2020 12:11 — forked from diego3g/.zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export ANDROID_HOME=~/Android/Sdk
export PATH="$PATH:$ANDROID_HOME/tools"
export PATH="$PATH:$ANDROID_HOME/platform-tools"
# Path to your oh-my-zsh installation.
export ZSH="/Users/diegofernandes/.oh-my-zsh"
export PATH="$PATH:/usr/local/bin"
@sthales
sthales / index.php
Created December 11, 2019 11:37 — forked from ZiTAL/index.php
php: telegram bot api example
<?php
// get API KEY: https://core.telegram.org/bots#botfather
// get chad id: http://stackoverflow.com/questions/31078710/how-to-obtain-telegram-chat-id-for-a-specific-user
$api_key = 'FAKE1234';
$chat_id = '7850602'
$url = "https://api.telegram.org/bot".$api_key."/";
// UNCOMMENT desired method
/*
The MIT License (MIT)
Copyright (c) 2014 Ismael Celis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@sthales
sthales / style.css
Created October 23, 2019 11:29 — forked from jbutko/style.css
#CSS: Show three dots (...) at the end of the line
span {
display:inline-block;
width:180px;
white-space: nowrap;
overflow:hidden !important;
text-overflow: ellipsis;
}
/* From http://stackoverflow.com/questions/11426275/how-can-i-show-dots-in-a-span-with-hidden-overflow*/
setTimeout(function () {
function getAllModules() {
return new Promise((resolve) => {
const id = _.uniqueId("fakeModule_");
window["webpackJsonp"](
[], {
[id]: function (module, exports, __webpack_require__) {
resolve(__webpack_require__.c);
}
}, [id]
@sthales
sthales / Lovelace.md
Created June 22, 2018 21:05 — forked from ciotlosm/Lovelace.md
Lovelace

Lovelace UI

Below you will find different types of cards available in the new Lovelace UI for Home Assistant.

For more in depth documentation on entities, please visit the developer documentation for Lovelace UI

The UI is structured in views and a view contains cards as seen on the example in the developer documentation.