Skip to content

Instantly share code, notes, and snippets.

View alejandrobernardis's full-sized avatar
🐻

Alejandro M. BERNARDIS alejandrobernardis

🐻
View GitHub Profile
@alejandrobernardis
alejandrobernardis / references.md
Last active October 18, 2019 03:20
REFERENCIAS
@alejandrobernardis
alejandrobernardis / bash.sh
Created October 3, 2019 02:12
back docker images
docker images --format "docker save -o {{.Repository}}_{{.Tag}}.tar {{.Repository}}:{{.Tag}}" | bash
local ret_status="%(?:%{$fg_bold[green]%}>:%{$fg_bold[red]%}>) "
if [[ "$USER" == "root" ]]; then user_mode="%{$fg_bold[red]%}"; else user_mode="%{$fg_bold[black]%}"; fi
function check_git() {
local _status
local cgit=$(printf '\e[38;5;141m')
if git rev-parse --git-dir > /dev/null 2>&1; then
_status=$(git_prompt_status 2> /dev/null)
[[ ! -z "$_status" ]] && _status=" ${_status}"
echo "$(parse_git_dirty) %{$fg_bold[black]%}git:($cgit$(git_current_branch)%{$fg_bold[black]%},$cgit${$(git_prompt_short_sha):-x}%{$fg_bold[black]%})${_status}" \
@alejandrobernardis
alejandrobernardis / createinstallmedia.sh
Last active August 27, 2015 01:51
Create Install Media (Mac OS X)
#!/bin/bash
# sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Yosemite.app --nointeraction
# sudo /Applications/Install\ OS\ X\ El\ Capitan\ Public\ Beta.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ El\ Capitan\ Public\ Beta.app —nointeraction
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ El\ Capitan\ Public\ Beta.app --nointeraction
@alejandrobernardis
alejandrobernardis / hosts.sh
Last active August 29, 2015 14:22
Hostsfix Function
function hostsfix() {
cp /etc/hosts /etc/hosts.backup
echo "" > /etc/hosts
cat >> EOF
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 domain.local
127.0.0.1 short.local
127.0.0.1 localhost.local
@alejandrobernardis
alejandrobernardis / ua.sh
Created May 20, 2015 19:31
Remove (uninstall) Android Studio
#!/bin/bash
rm -fR /Applications/Android\ Studio.app
rm -fR ~/Library/Preferences/AndroidStudio*
rm -f ~/Library/Preferences/com.google.android.*
rm -fR ~/Library/Application\ Support/AndroidStudio*
rm -fR ~/Library/Logs/AndroidStudio*
rm -fR ~/Library/Caches/AndroidStudio*
# (optional) rm -Rf ~/Library/Android*
rm -fR ~/.gradle
"""Demo of streaming requests with Tornado.
This script features a client using AsyncHTTPClient's body_producer
feature to slowly produce a large request body, and two server
handlers to receive this body (one is a proxy that forwards to the
other, also using body_producer).
It also demonstrates flow control: if --client_delay is smaller than
--server_delay, the client will eventually be suspended to allow the
server to catch up. You can see this in the logs, as the "client
#!/usr/bin/env python
"""This is a demonstration of sharing file descriptors across processes.
It uses Tornado (need a recent post-2.0 version from github) and the
multiprocessing module (from python 2.6+). To run it, start one copy
of fdserver.py and one or more copies of testserver.py (in different
terminals, or backgrounded, etc). Fetch http://localhost:8000 and
you'll see the requests getting answered by different processes (it's
normal for several requests to go to the same process under light
load, but under heavier load it tends to even out).
@alejandrobernardis
alejandrobernardis / pycharm.py
Created May 5, 2015 13:33
PyCharm Template
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# Copyright (c) ${YEAR} Asumi Kamikaze Inc.
# Licensed under the MIT License.
# Author: Alejandro M. Bernardis
# Email: alejandro (dot) bernardis (at) asumikamikaze (dot) com
# Created: ${DAY}/${MONTH_NAME_SHORT}/${YEAR} ${HOUR}:${MINUTE}