TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main| const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); | |
| const pixels = imageData.data; | |
| for (let i = 3, n = canvas.width * canvas.height * 4; i < n; i += 4) { | |
| pixels[i] = pixels[i] < 127? 0 : 255 | |
| } | |
| ctx.putImageData(imageData, 0, 0); |
| import asyncio | |
| loop = asyncio.get_event_loop() | |
| async def hello(): | |
| await asyncio.sleep(3) | |
| print('Hello!') | |
| if __name__ == '__main__': | |
| loop.run_until_complete(hello()) | |
TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main| import urllib.request | |
| url = 'http://www.portaltransparencia.gov.br/copa2014/api/rest/empreendimento' | |
| resp = urllib.request.urlopen(url).read().decode('utf-8') | |
| total = 0 | |
| j = 0 | |
| while True: | |
| abre = '<valorTotalPrevisto>' | |
| fecha = '</valorTotalPrevisto>' | |
| j = resp.find(abre, j) | |
| if j == -1: |
| # zsh | |
| EMOJI=(๐ฉ ๐ฆ ๐ ๐ ๐จ ๐ ๐ญ ๐ฝ โ๏ธ ๐ฌ ๐ ๐ท ๐ผ ๐ถ ๐ธ ๐ง ๐ณ ๐ ๐ฃ ๐ป ๐ฎ ๐ฐ ๐ ๐พ ๐ ๐ช ๐ ๐ ๐ ๐ ๐ ) | |
| function random_emoji { | |
| echo -n "$EMOJI[$RANDOM%$#EMOJI+1]" | |
| } | |
| PROMPT="$(random_emoji) " | |
| RPROMPT='%c' |
| # zsh | |
| EMOJI=(๐ฉ ๐ฆ ๐ ๐ ๐จ ๐ ๐ญ ๐ฝ โ๏ธ ๐ฌ ๐ ๐ท ๐ผ ๐ถ ๐ธ ๐ง ๐ณ ๐ ๐ฃ ๐ป ๐ฎ ๐ฐ ๐ ๐พ ๐ ๐ช ๐ ๐ ๐ ๐ ๐ ) | |
| function random_emoji { | |
| echo -n "$EMOJI[$RANDOM%$#EMOJI+1]" | |
| } | |
| PROMPT="$(random_emoji) " | |
| RPROMPT='%c' |
| # Steps to build and install tmux from source. | |
| # Takes < 25 seconds on EC2 env [even on a low-end config instance]. | |
| VERSION=2.7 | |
| sudo yum -y remove tmux | |
| sudo yum -y install wget tar libevent-devel ncurses-devel | |
| wget https://github.com/tmux/tmux/releases/download/${VERSION}/tmux-${VERSION}.tar.gz | |
| tar xzf tmux-${VERSION}.tar.gz | |
| rm -f tmux-${VERSION}.tar.gz | |
| cd tmux-${VERSION} |
| // These two need to be declared outside the try/catch | |
| // so that they can be closed in the finally block. | |
| HttpURLConnection urlConnection = null; | |
| BufferedReader reader = null; | |
| // Will contain the raw JSON response as a string. | |
| String forecastJsonStr = null; | |
| try { | |
| // Construct the URL for the OpenWeatherMap query |
| # Install ARCH Linux with encrypted file-system and UEFI | |
| # The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description. | |
| # Download the archiso image from https://www.archlinux.org/ | |
| # Copy to a usb-drive | |
| dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux | |
| # Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration. | |
| # Set swedish keymap |
| docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt |