Skip to content

Instantly share code, notes, and snippets.

View giggio's full-sized avatar
💭
Nada a perder.

Giovanni Bassi giggio

💭
Nada a perder.
View GitHub Profile
@giggio
giggio / install-docker-xenial.sh
Last active October 13, 2016 22:31
install-docker
#!/usr/bin/env bash
apt-get update
apt-get -y install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get purge lxc-docker
apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
apt-get install -y docker-engine
unidades = ['um', 'dois', 'tres', 'quatro', 'cinco', 'seis', 'sete', 'oito']
dezenas = ['dez', 'vinte']
centenas = ['cento']
class Letras:
def __init__(self, numero):
if numero > 100:
centena = int(numero / 100)
dezena = int((numero - (centena * 100))/ 10)
unidade = numero - (centena * 100) - (dezena * 10)
@giggio
giggio / npm.cmd
Created February 2, 2016 16:54 — forked from mykohsu/npm.cmd
Alternative npm.cmd for VS201X node tools integration. Caches npm ls -g result until a different npm command is issued.
@ECHO OFF
SETLOCAL
SET "NODE_EXE=%~dp0\node.exe"
IF NOT EXIST "%NODE_EXE%" (
SET "NODE_EXE=node"
)
SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
@giggio
giggio / aperf.csx
Last active January 27, 2016 17:04
C# Script testing "is" perf vs reflection
using System.Diagnostics;
using static System.Console;
interface IFoo { }
interface BaseBase { }
interface Base : BaseBase { }
class Foo : Base, IFoo { }
struct Bar : IFoo { }
struct Baz : IFoo { }
@giggio
giggio / backupPartition
Last active February 19, 2016 05:04
Backup sd card partitions
#!/bin/bash
echo deleting local files older than a week...
find /media/data/backup/* -mtime +7 -type f -delete
echo backuping up /dev/mmcblk0p1...
if [ ! -f /media/data/backup/$(date +%Y%m%d)_mmcblk0p1.img ]; then
dd if=/dev/mmcblk0p1 of=/media/data/backup/$(date +%Y%m%d)_mmcblk0p1.img
fi
echo backuping up /dev/mmcblk0p2...
set editing-mode vi
set bell-style none
set show-all-if-ambiguous on
set completion-ignore-case on
# on menu-complete, first display the common prefix, then cycle through the options when hitting TAB
set menu-complete-display-prefix on
set keymap vi-command
"gg": beginning-of-history
set-option -g status-utf8 on
set-option -g utf8 on
set -g default-terminal "screen-256color"
set-option -g default-shell /bin/bash
set -g history-limit 10000
source "/home/giovanni/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf"
set -g status-bg colour233
set-option -g status-position top
set -g mouse
@giggio
giggio / terminatorConfig
Created April 12, 2014 23:31
My terminator configuration
#terminator config, located at ~/.config/terminator/config
[global_config]
suppress_multiple_term_dialog = True
window_state = "fullscreen"
[keybindings]
[profiles]
[[default]]
background_image = None
background_color = '#300a24'
background_type = 'transparent'
msgwait 0
@giggio
giggio / MainWindow.xaml
Created February 26, 2014 14:39
Exemplo de código assíncrono com async e await no C#
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Content="Button" HorizontalAlignment="Left" Margin="155,60,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/>
<Label x:Name="lbl" Content="Label" HorizontalAlignment="Left" Margin="156,108,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txt" HorizontalAlignment="Left" Height="23" Margin="156,31,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
</Grid>