Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am guionardo on github.
  • I am guionardo (https://keybase.io/guionardo) on keybase.
  • I have a public key ASCsP5sZ2wY21-ZHaJevW-pDvr6yFUpfSiTBHbfYbT9Ttwo

To claim this, I am signing this object:

@guionardo
guionardo / Instructions.md
Created May 26, 2018 23:13 — forked from glocore/Instructions.md
Setup React Native on Ubuntu 16.04/16.10

1. Install Node.js

  • Follow the steps given here to install Node.js and NPM.
  • Verify whether NPM is installed by typing npm -v in a terminal window.

2. Install React Native CLI

  • npm install -g react-native-cli

3. Setup Android Development Environment

  • Download and install Android Studio as explained here.
  • Run Android Studio and open the SDK Manager. Under the SDK Platforms tab, check Show Package Details, expand Android 6.0 (Marshmallow) and check the following:
@guionardo
guionardo / messagebox_timeout.cs
Last active August 22, 2018 11:59
MessageBox with timeout (c#)
[DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);
[DllImport("user32.Dll")]
static extern int PostMessage(IntPtr hWnd, UInt32 msg, int wParam, int lParam);
public static void MessageBox(string Text, string Caption = "", int timeOut = 0)
{
if (Caption.Length == 0)
Caption = "MessageBox";
@guionardo
guionardo / lambda_example.py
Last active November 27, 2018 17:58
Lambda operator example in Python
#!/bin/python
n1=int(input("digite numero :"))
n2=int(input("digite numero :"))
oper=input("digite soma = +,subtração = -,multiplicação = *,divisao = /:")
#soma
if (oper=="+"):
print("resultado = ",n1+n2)
@guionardo
guionardo / .bashrc
Created November 30, 2019 13:47
.bashrc with git informations
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@guionardo
guionardo / example.py
Last active July 31, 2020 04:04
Python singleton decorator class
@Singleton
class DBConnection(object):
def __init__(self):
"""Initialize your database connection here."""
pass
def __str__(self):
return 'Database connection object'
@guionardo
guionardo / bus_list.py
Created June 30, 2020 23:02
Bus List in python
from collections.abc import Iterable
class BusList(list):
""" Bus (FIFO) list
"""
def __init__(self, *args):
self._max_length = 0
for arg in args:
@guionardo
guionardo / progress.py
Created June 2, 2021 18:21 — forked from vladignatyev/progress.py
Python command line progress bar in less than 10 lines of code.
# The MIT License (MIT)
# Copyright (c) 2016 Vladimir Ignatev
#
# 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 furnished to do so, subject to the following conditions:
#
@guionardo
guionardo / delete_old.sh
Created December 8, 2021 10:17
Deleting files but keeping some in bash
#!/usr/bin/env bash
# With this tool you can delete files using a mask, but keeping some files
# I've wrote this tool to house keep log files
# Usage: bash delete_old.sh <number of files to keep> "folder/mask"
# If you use mask like * or ? in your command, add quotes to prevent enumeration
keep=$(($1))
folder=${2:-...}
@guionardo
guionardo / combina_faturas.php
Created December 16, 2021 12:42
Combinação de faturas
<?php
function permutations($pool, $r = null) {
$n = count($pool);
if ($r == null) {
$r = $n;
}
if ($r > $n) {
return;