Skip to content

Instantly share code, notes, and snippets.


Dayvson Silva userddssilva

View GitHub Profile
userddssilva / .vimrc
Last active Aug 23, 2019
configures of my vim
View .vimrc
"edit setting
"set nowrap "lines can be greater than shell width (maybe necessary to scroll horizontally
set rnu "enable relative number
set autoindent "indent new line NORMAL mode
set smartindent "indent according to text style
userddssilva /
Created Jan 31, 2020 — forked from stefanthoss/
Import data from a MySQL database table into a Pandas DataFrame using the pymysql package.
import pandas as pd
import pymysql
from sqlalchemy import create_engine
engine = create_engine('mysql+pymysql://<user>:<password>@<host>[:<port>]/<dbname>')
df = pd.read_sql_query('SELECT * FROM table', engine)
#@title Download Dataset to Google Colab { form-width: "800px" }
LinkFile = "" #@param {type:"string"}
Filename = "" #@param {type:"string"}
Filename = Filename.replace(' ', '\ ')
userddssilva /
Last active Feb 3, 2021
How to make a flat list out of list of lists?
import itertools
list2d = [[1,2,3], [4,5,6], [7], [8,9]]
merged = list(itertools.chain.from_iterable(list2d))
export PATH="${PATH}:/home/dayvson/.local/bin"
# The PYTHONPATH variable has a value that is a string with a list of directories
# that Python should add to the sys.path directory list.
# The main use of PYTHONPATH is when we are developing some code that we want to
# be able to import from Python, but that we have not yet made into an installable
# Python package (see: making a Python package).
export PYTHONPATH="${PYTHONPATH}:/home/dayvson/.local/lib/python3.8/site-packages/*"
export PYTHONPATH="${PYTHONPATH}:/home/dayvson/.local/lib/python3.8/site-packages/*/*"
userddssilva /
Last active Feb 3, 2021
Send files .md to github gist of a folder
for file in `ls *.md`
echo "Sending file: "
echo $file
putgist userddssilva $file
sleep 5
echo "Done"
echo ""
View search_toolbar_in_android.kt
override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate layout menu
menuInflater.inflate(, menu)
// Initialize menu item
val menuItem: MenuItem = menu.findItem(
// Initialize search view
val searchView: SearchView = getActionView(menuItem) as SearchView
searchView.setOnQueryTextListener ( object : SearchView.OnQueryTextListener {
override fun onQueryTextChange(newText: String): Boolean {
userddssilva / android_hide_toobar.kt
Last active Apr 7, 2021
Esconde a barra de ferramentas android e deixa a tela full screen
View android_hide_toobar.kt
try {
} catch (e: NullPointerException) {}
View save_file_on_console_javascript.js
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename); = 'none';
userddssilva / MaskBrMonetaryValue.kt
Last active Apr 7, 2021
Este gist contém uma mascara de valores monetários usados no brasil, foi implementada em kotlin
View MaskBrMonetaryValue.kt
package br.uea.transirie.mypay.mylaundry.util
import android.text.Editable
import android.text.TextWatcher
import android.widget.EditText
class MaskBrMonetaryValue {
companion object {
fun mask(editableText: EditText): TextWatcher {
return object : TextWatcher {