Skip to content

Instantly share code, notes, and snippets.

⌨️
keyboard shredding

Miguel Mota miguelmota

⌨️
keyboard shredding
Block or report user

Report or block miguelmota

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miguelmota
miguelmota / command_exists.sh
Created Jun 24, 2019
Bash check if command exists example
View command_exists.sh
# check that realpath command exists
if ! type "realpath" > /dev/null; then
printf "$red%s$normal$nc\n" "\"realpath\" command is not installed"
exit 1
fi
@miguelmota
miguelmota / my_program
Last active Jun 24, 2019
Node.js bin env header (NPM module as executable bin file)
View my_program
#!/usr/bin/env node
console.log('my program')
@miguelmota
miguelmota / script.sh
Created Jun 23, 2019
Linux (Ubuntu) fix for "Error: not found: make"
View script.sh
sudo apt-get install build-essentials
@miguelmota
miguelmota / script.sh
Created Jun 23, 2019
Node.js fix error "Cannot read property 'match' of undefined"
View script.sh
rm package-lock.json
@miguelmota
miguelmota / script.sh
Created Jun 23, 2019
Node.js fix for error "sh: 1: node: Permission denied"
View script.sh
npm config set user 0
npm config set unsafe-perm true
@miguelmota
miguelmota / notes.md
Last active Jun 26, 2019
TypeScript add custom @types (declare module)
View notes.md
  • create @types/ directory in your application
  • add @types/my-module/index.d.ts with declare module 'my-module'
@miguelmota
miguelmota / contract.sol
Created Jun 17, 2019
Solidity uint256 to byte (bytes1)
View contract.sol
uint256 i = 10;
byte(uint8(i));
@miguelmota
miguelmota / timezone.go
Created Jun 13, 2019
Golang set timezone for time example
View timezone.go
package main
import (
"fmt"
"time"
)
func main() {
loc, err := time.LoadLocation("America/Los_Angeles")
if err != nil {
@miguelmota
miguelmota / .env
Created Jun 12, 2019
Golang dotenv (.env) example
View .env
HOST=127.0.0.1
@miguelmota
miguelmota / remove_empty_newlines.sh
Created Jun 11, 2019
Bash remove empty newlines using awk
View remove_empty_newlines.sh
awk 'NF' file.txt
# or
cat file.txt | awk 'NF'
You can’t perform that action at this time.