Skip to content

Instantly share code, notes, and snippets.

View TheFern2's full-sized avatar

Fernando B TheFern2

View GitHub Profile
from pyfirmata import Arduino, util
import time
from eip import PLC
def boolean_read(tag):
'''
simple tag read
'''
return comm.Read(tag)
Name: Flash
Serial: eNrzzU/OLi0odswsqnHLSSzOqDGoca7JKCkpsNLXLy8v1ytJTczVLUotKNFLzs8FAJHYETc=
if anyone wants to thank ETH: 0x527c2aB55b744D6167dc981576318af96ed26676
Thank you!
@TheFern2
TheFern2 / vimrc
Last active July 15, 2019 08:03
My Vimrc Configuration
" General Settings {{{
set nocompatible "vim, not vi
filetype plugin indent on
set number
set tabstop=4
set background=dark
syntax enable
set laststatus=2
" }}}
@TheFern2
TheFern2 / Initial-Server-Setup.md
Last active September 15, 2019 21:30
Droplet Ubuntu 18.04 Notes

Setup

Once droplet is spinning, run through initial server setup:

Initial Server Setup Setup formatted as markdown for future reference

Introduction

When you first create a new Ubuntu 18.04 server, there are a few configuration steps that you should take early on as part of the basic setup. This will increase the security and usability of your server and will give you a solid foundation for subsequent actions.

Note: The guide below demonstrates how to manually complete the steps we recommend for new Ubuntu 18.04 servers. Following this procedure manually can be useful to learn some basic system admi

@TheFern2
TheFern2 / Bash-Stuff.md
Created September 22, 2019 07:15
Linux Things

Aliases

In order to keep bashrc or bash_profile clean, aliases should go in the bash_aliases file. Add below IF to bashrc.

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
@TheFern2
TheFern2 / Pip-Dev.md
Last active September 23, 2019 05:50
Pip Packages Development

Install Pip Packages

If you want to test a PIP package located in a local git repository you can do it this way:

pip install git+file:///path/to/your/git/repo
@TheFern2
TheFern2 / Commits.md
Last active September 25, 2019 23:34
Git Commands for mere mortals

Better commit messages

This is my custom commit message:

# If this commit is applied, it will... (Less than 50 chars)

# Why was this change made?

# How does it address the issue?
@TheFern2
TheFern2 / Update-branch.md
Created September 28, 2019 02:37 — forked from santisbon/Update-branch.md
Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master

@TheFern2
TheFern2 / Local PR test and merge.md
Created September 28, 2019 04:54 — forked from adam-p/Local PR test and merge.md
Testing a pull request, then merging locally; and avoiding TOCTOU

It's not immediately obvious how to pull down the code for a PR and test it locally. But it's pretty easy. (This assumes you have a remote for the main repo named upstream.)

Getting the PR code

  1. Make note of the PR number. For example, Rod's latest is PR #37: Psiphon-Labs/psiphon-tunnel-core#37

  2. Fetch the PR's pseudo-branch (or bookmark or rev pointer whatever the word is), and give it a local branch name. Here we'll name it pr37:

$ git fetch upstream pull/37/head:pr37
@TheFern2
TheFern2 / post-checkout
Created September 28, 2019 07:47
Git Scripts
#! /bin/sh
# Start from the repository root.
cd ./$(git rev-parse --show-cdup)
# Delete .pyc files and empty directories.
# These files become a problem when switching branches
# if pycache is there with pyc even as an empty folder it will show up
# on another branch under vscode, this fixes that.
# @kodaman2