Skip to content

Instantly share code, notes, and snippets.

View graffic's full-sized avatar

Javier Gonel graffic

View GitHub Profile
@graffic
graffic / gist:6c15f8c2b4f0f208939e
Created May 11, 2014 19:49
Uncle bob "Framework Whipped" original post

Framework Whipped

Uncle Bob 11 May 2014 Craftsmanship Frameworks are powerful tools. We'd be lost without them. But there's a cost to using them.

The relationship between a programmer and a framework is similar to the relationship between an executive and an administrative assistant. The framework takes care of all the necessary details, so that the executive can focus on high level decisions.

Think of Rails, or Spring, or JSF, or Hibernate. Think about what writing a web system would be like without these frameworks to help you. The idea is disheartening. There'd be so many little piddling details to deal with. It'd be like endeavoring to construct a mnemonic memory circuit using stone knives and bearskins[1].

And so we gleefully use those glittering frameworks. We joyously intermingle our code with the frameworks' in anticipation of all the benefits they promise. We make the mistake that so many executives have made before us. We marry our secretary.

Keybase proof

I hereby claim:

  • I am graffic on github.
  • I am graffic (https://keybase.io/graffic) on keybase.
  • I have a public key whose fingerprint is D44E 1E92 061C 54D4 964F 4470 D075 45BC 53D6 9D57

To claim this, I am signing this object:

@graffic
graffic / async.py
Created September 9, 2015 16:41
Async demo python 3.5
import aiohttp
import asyncio
async def get(index):
response = await aiohttp.get('http://httpbin.org/delay/%d' % index)
print(index, "Done")
response.close()
async def doMany():
coros = []
@graffic
graffic / maze.py
Created January 27, 2017 03:12
bkkhack tournament
maze = """XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXX.XXXXX XXXXX XXXXXXXXXXX
XXX XXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXX XXXXXXXXXXX
XXX XX XXXXXXXX XXX XXXX XXXXX XXXX
XXX XX XXXXXXXXXXXXXX XXXXXXXX XXX XXXX XXXXX XXXX
XXX XX XXXXXXXXXXXXXX XX X XXX XXX XXXX XXXXX XXXX
XXX XX XXX XXXXXX XX X XXX XXX XXXX XXXXX XXXX
XXX XX XXX XXX XXXXXX XX X XXX XXX XXXX XXXXX XXXX
XXX XX XXX XXX XXXXXX XX X XXX XXXXXXXXXX XXXXX XXXX
XXX XX XXX XXXXXX XX X XXX XXXXX XXXXX XXXX
@graffic
graffic / Dockerfile
Created August 17, 2017 07:08
Alpine, java8, druid, mysql docker image
FROM anapsix/alpine-java:8_server-jre
ENV DRUID_VERSION=0.10.0 \
ZOOKEEPER_VERSION=3.4.10 \
PATH=/usr/local/bin:${PATH}
# Prepare the container to install the software
RUN set -ex && \
apk upgrade --update && \
apk add --update curl mariadb mariadb-client supervisor && \
@graffic
graffic / steam.md
Last active July 20, 2025 09:58
Downloading steam games from another computer/faster line

Framing the issue

With almost no bandwith at home, I needed a way to download DOOM that didn't involve blocking the home internet line for two days.

Approach

Using steamcmd you can use any computer to download steam games.

Downloading

  1. Install it
  2. Open it and loging with your username and password: login username password
@graffic
graffic / 0.10.1_full_services_pom.xml
Last active December 9, 2017 10:36
Druid 0.11 & 0.10.1 poms to compile with CDH 5.10.2
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Druid - a distributed column store.
~ Copyright 2012 - 2015 Metamarkets Group Inc.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
// Run in console or as a snippet in Chrome
(function() {
const parseUs = x => parseFloat(x.replace(",",""));
const parseEu = x => parseFloat(x.replace(/[,.]/g, y => y == "," ? "." : ","))
const parsers = new Map([
[",", parseEu],
[".", parseUs]
]);
const matcher = /^([^\d]?)([\d\,\.]+\d\d)([^\n\d]?)(\nCredit|)/m;
const matchNode = x => matcher.exec(x.innerText);
@graffic
graffic / fix_erlang.sh
Created June 23, 2018 09:15
Macports utils
#!/bin/bash
set -x
cd $MACPORTS/var/macports/sources/rsync.macports.org/release/tarballs/ports/
sed -i '' '/libGLU/d' ./lang/erlang/Portfile
portindex
@graffic
graffic / test_something.py
Created April 26, 2019 07:34
Django tests show SQL queries
from django.test import TestCase
class TestSomething(TestCase):
def setUp(self):
from django.conf import settings
settings.DEBUG=True
def test_something(self):
pass