Skip to content

Instantly share code, notes, and snippets.

View arturoaviles's full-sized avatar

Arturo Avilés arturoaviles

View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@arturoaviles
arturoaviles / zipEachDirectory.sh
Created November 23, 2017 17:22
Zip each directory on its own
# Multiline version
#for i in *
#do
#[ -d "$i" ] && zip -r "$i.zip" "$i"
#done
# 1 line version
for i in */; do zip -r "${i%/}.zip" "$i"; done
@arturoaviles
arturoaviles / pytest-testing-done-correctly.sh
Created January 31, 2018 01:03
Pytest Testing Done Correctly
# Make sure you have Python 3 installed
python3 -v
# Install pyenv
pip3 install pyenv
# Add the following lines to your .bashrc or .zshrc as estipulated on the Pyenv Github:
# export PYENV_ROOT="$HOME/.pyenv"
# export PATH="$PYENV_ROOT/bin:$PATH"
@arturoaviles
arturoaviles / golang_json.go
Created February 26, 2018 22:13
Use Json in Golang
birdJson := `{"birds":{"pigeon":"likes to perch on rocks","eagle":"bird of prey"},"animals":"none"}`
var result map[string]interface{}
json.Unmarshal([]byte(birdJson), &result)
// The object stored in the "birds" key is also stored as
// a map[string]interface{} type, and its type is asserted from
// the interface{} type
birds := result["birds"].(map[string]interface{})
for key, value := range birds {
@arturoaviles
arturoaviles / detach
Last active March 21, 2018 01:26
Docker Get Container Bash
By typing ctrl+p and ctrl+q after each other, you turn interactive mode to daemon mode, which keeps the container running but frees up your terminal.
@arturoaviles
arturoaviles / example.sh
Created March 23, 2018 14:52
Check Server IP
nslookup google.com
@arturoaviles
arturoaviles / index.html
Created April 19, 2018 00:18
Twitter Char Counter with Pure Javascript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--<link rel="stylesheet" type="text/css" media="screen" href="main.css" />-->
<script src="main.js"></script>
</head>
@arturoaviles
arturoaviles / index.html
Created April 19, 2018 14:52
Full Screen iFrame at background
<iframe id="background-website" src="https://www.website.com" scrolling="yes" frameborder="0"></iframe>
@arturoaviles
arturoaviles / steps.txt
Created July 12, 2018 01:30
Removing Secrets from Git Repos and History
https://help.github.com/articles/removing-sensitive-data-from-a-repository/
Removing sensitive data from a repository
If you commit sensitive data, such as a password or SSH key into a Git repository, you can remove it from the history. To entirely remove unwanted files from a repository's history you can use either the git filter-branch command or the BFG Repo-Cleaner.
The git filter-branch command and the BFG Repo-Cleaner rewrite your repository's history, which changes the SHAs for existing commits that you alter and any dependent commits. Changed commit SHAs may affect open pull requests in your repository. We recommend merging or closing all open pull requests before removing files from your repository.
You can remove the file from the latest commit with git rm. For information on removing a file that was added with the latest commit, see "Removing files from a repository's history."
@arturoaviles
arturoaviles / watson_conversation_entities_proximity_in_a_string.md
Created October 6, 2018 00:29
Watson Conversation Entities Proximity in an Input String

Watson Conversation Entities Proximity in an Input String

This method can be used when you want to detect if 2 entities are next to each other

Example #1 Negative Number

In this example you get -1 if the entities are next to each other, you can change the order of the operation like in the example 2 to get the positive number 1.

Formula