Skip to content

Instantly share code, notes, and snippets.

View onlurking's full-sized avatar
:shipit:
ship it

Diogo Felix onlurking

:shipit:
ship it
View GitHub Profile
@onlurking
onlurking / docker
Created February 24, 2017 06:23
OpenRC Docker Service
#!/usr/bin/openrc-run
# $Header: $
start() {
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --background --exec /usr/bin/dockerd
eend $?
}
stop() {
<script language= "JavaScript">
eval(function(p, a, c, k, e, r) {
e = function(c) {
return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
};
if (!''.replace(/^/, String)) {
while (c--) r[e(c)] = k[c] || e(c);
k = [function(e) {
return r[e]
}];
import asyncio
from urllib.request import urlopen
async def produce_lines(filename, delay):
try:
with open(filename, 'r') as file:
for line in file:
yield line.rstrip('\n')
await asyncio.sleep(delay)
import asyncio
from os import devnull
from urllib.request import urlopen
from urllib.parse import quote
from subprocess import call
async def produce_lines(filename):
try:
with open(filename, 'r') as file:
import asyncio
from urllib.request import urlopen
async def produce_lines(filename):
try:
with open(filename, 'r') as file:
for line in file:
yield line.rstrip('\n')
await asyncio.sleep(1)
@onlurking
onlurking / errata-hy.md
Last active December 20, 2017 17:26
Errata: Cara tem um Lisp no seu Python..? (Ou uma introdução sobre Hy)

ERRATA, Cara tem um Lisp no seu Python..?

Ou uma introdução sobre Hy

Eu submeti a proposta de fazer uma palestra no Lambda I/O Sampa Meetup falando um pouco sobre Hy (Um Lisp embedded no Python), uma linguagem que eu vinha brincando um pouco nos finais de semana, é meu primeiro contato com Lisp, e vinha sendo bem confortável já que eu conseguia fazer algumas coisas úteis com ela, é interop com Python, e eu estava reescrevendo alguns de meus código que usam BeautifulSoup e Requests com sintaxe Lisp.

O que deu bom

Esta foi a primeira palestra que eu dei e foi uma experiência absurda, eu nunca aprendi tanto em tão pouco tempo com meus próprios erros.

Conheci muita gente pessoalmente que só conhecia pela internet, pensa numa galera gente boa.. na moral, vocês são fera! Obrigado por tudo.

Grab the nteract

wget https://github.com/nteract/nteract/releases/download/v0.0.15/nteract-0.0.15-linux.tar.gz
tar -xvf "nteract-0.0.15-linux.tar.gz"

Install IPython and Hy

sudo pip3 install hy ipython ipykernel
python3 -m ipykernel install --user
#! /usr/bin/env hy
(import requests
string
[bs4 [BeautifulSoup]]
[sys [argv]])
(defn get_page [link]
(-> (. (.get requests link) text)
{
"always_show_minimap_viewport": true,
"caret_extra_bottom": 1,
"caret_extra_top": 1,
"caret_extra_width": 1,
"caret_style": "blink",
"color_scheme": "Packages/Boxy Theme/schemes/Boxy Tomorrow.tmTheme",
"detect_indentation": false,
"fade_fold_buttons": false,
"font_size": 11,