Skip to content

Instantly share code, notes, and snippets.

View XayOn's full-sized avatar
🐍

David Francos XayOn

🐍
View GitHub Profile
"""RPS"""
def play():
scores = {"user": 0, "computer": 0}
while not any(a==WIN for a in scores.values):
print(f'Scores: U:{scores["user"]}. C: {scores["computer"]}')
user = None
comp = random.choice(CHOICES.keys())
while user not in CHOICES.keys():
user = raw_input("rock, paper, scissors")
if user == comp:
import random
CHOICES = {'rock': 'scissors', 'paper': 'rock', 'scissors': 'paper'}
SCORES = {"user": 0, "comp": 0, 'draw': 0}
while not any(a == 3 for a in SCORES.values()):
user = input("Enter rock, paper or scissors: ")
SCORES[{True: "user", False: "comp"}.get(
CHOICES.get(user) == random.choice(list(CHOICES.keys())), 'draw')] += 1
print(f'U:{SCORES["user"]}. C: {SCORES["comp"]}, D: {SCORES["draw"]}')
class Formatter:
pass
class DefaultFormatter(Formatter):
name = "default"
def format(string):
return string
class UpperFormatter(Formatter):
name = "bar"
call plug#begin('~/.vim/plugged')
" VCS
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" Terminal
Plug 'Lenovsky/nuake'
" Easy align
Plug 'junegunn/vim-easy-align'
@XayOn
XayOn / pt.vim
Created May 26, 2019 16:41
Vim configuration for prettierTerminal
call plug#begin('~/.config/nvim/plugged')
" Git tools
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
Plug 'Xuyuanp/nerdtree-git-plugin'
" Quake-like terminal
Plug 'Lenovsky/nuake'
" Easy align
@XayOn
XayOn / get_all_bitbucket_repos.sh
Created June 12, 2019 14:09
Clone all bitbucket repositories using ssh for a specific organization
# Usage $0: <org_name> <user> <password>
shopt -s lastpipe; set +m;
print_elements(){
curr=$(http get $1 -a "$2:$3")
jq -r '.values[].links.clone[] | select(.name == "ssh")|.href' <<< $curr
jq -r .next <<< $curr|read next_url
[[ $next_url != "null" ]] && print_elements $next_url $2 $3
}
while read repo; do git clone $repo; done < <(print_elements "https://api.bitbucket.org/2.0/repositories/$3/" $1 $2)
@XayOn
XayOn / nerdget.sh
Last active August 30, 2019 23:02
Get Nerd Font from latest release
get_nerd_font(){ wget $(wget https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest -O - | jq -r ".assets[]|select(.name==\"$1.zip\").browser_download_url")}
set_mono_font() {
mkdir ~/.config/fontconfig/;
echo '<match target="pattern"><test name="family" qual="any"><string>monospace</string></test><edit binding="strong" mode="prepend" name="family"><string>Sa<match target="pattern"><test name="family" qual="any"><string>monospace</string></test><edit binding="strong" mode="prepend" name="family"><string>$1</string></edit>
$1</string></edit>' > ~/.config/fontconfig/fonts.conf
}
magnet:?xt=urn:btih:0a2b571295d0141566d4b4cc4343e4a4785d8ef8&dn=Arturo+Perez-Reverte+(colecci%C3%B3n+completa+-+27+libros)&tr=udp%3A%2F%2Feddie4.nl%3A6969&tr=udp%3A%2F%2Fopentrackr.org%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969&tr=udp%3A%2F%2Ftracker.zer0day.to%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com
magnet:?xt=urn:btih:bf187ea7c047bf380dca0d98282c8b2114b89057&dn=Coleccion+Libros+Espa%26Atilde%3B%26plusmn%3Bol+formato+MOBI&tr=udp%3A%2F%2F9.rarbg.to%3A2920%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.cyberia.is%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com;magnet:?xt=urn:btih:abd6500d1a6420b05e5d668e2fe6caff8e14aef8&dn=Gabriel+Garcia+Marquez+Espa%C3%83%C2%B1ol+pdf+12+libros&tr=udp%3A%2F%2F9.rarbg.to%3A2920%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.cyberia.is%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A
magnet:?xt=urn:btih:e84775cd5281dc55e27e0ede2c6105f5ad09e430&dn=BIBLIOTECA+CASTELLANO&tr=http%3A%2F%2Ftracker.openwebtorrent.com%2F&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com