Skip to content

Instantly share code, notes, and snippets.

View mariocesar's full-sized avatar

Mario-César mariocesar

View GitHub Profile
@ColinDuquesnoy
ColinDuquesnoy / html_logger.py
Last active November 18, 2024 05:15
HTML logger for python (inspired by the Horde3D logger)
"""
HTML logger inspired by the Horde3D logger.
Usage:
- call setup and specify the filename, title, version and level
- call dbg, info, warn or err to log messages.
"""
import logging
import time
@MarsVard
MarsVard / README
Last active November 3, 2022 19:19
android drawable to imitate google cards.
put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file.
set the background of a view to card,
as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view
``` xml
<View
android:layout_width="fill_parent"
@dnmellen
dnmellen / ocrshot.py
Last active March 2, 2023 11:06
Takes an screenshot (the user draws a rectangle to select the interesting area), scans the resulting image and copy the text to clipboard
#!/usr/bin/python -tt
"""
Takes an screenshot (the user draws a rectangle to select the interesting area), scans the resulting image and copy the text to clipboard
- scrot (http://en.wikipedia.org/wiki/Scrot)
- readbot (`pip install readbot`)
- pyperclip (`pip install pyperclip`)
"""
@shawndumas
shawndumas / obsession.sh
Last active January 2, 2016 12:49
hn leaders
lynx -dump -nonumbers -nolist https://news.ycombinator.com/leaders | head -14 | tail
Thank You. We’re going to speak against the proposition that has been put forward, which says that the government should be allowed to censor content on the Internet. Before I start, I’d like to say that I’m not trying to support an unchecked flow of information on the web which might lead to harmful consequences to individuals. It’s not going to be my contention, not going to be my side’s contention.
Freedom of expressing your views and opinions is different from hate speech, threats of violence, data theft and other illegal activities. One has law on its side, while the other does not. So, that is not one of the things this side is going to argue against, today.
So, now, when we begin to think about the question put forward today, about whether the government has the right to limit the rights of the citizens of the country, we have to consider every aspect of how this theoretical right would work in a functioning democratic society.
Starting with the legal technicalities: The Constitution of India, which
@liquidgecka
liquidgecka / cron_helper.sh
Last active September 28, 2023 15:35
Cron helper
#!/bin/bash
usage() {
cat << EOF
Usage: $0 [OPTION]... COMMAND
Execute the given command in a way that works safely with cron. This should
typically be used inside of a cron job definition like so:
* * * * * $(which "$0") [OPTION]... COMMAND
Arguments:
@evansd
evansd / json.py
Last active August 29, 2015 14:01
from __future__ import absolute_import
import json
import re
from django import template
from django.utils.html import format_html_join
register = template.Library()
@aaugustin
aaugustin / djangoauth.py
Created July 29, 2014 12:49
WSGI middleware that authenticates against a Django user database.
"""
WSGI middleware that authenticates against a Django user database.
DJANGO_SETTINGS_MODULE should point to a valid Django settings module.
In addition, the following settings are available:
- BASIC_AUTH_LOGIN_URL: DjangoAuth will trigger basic authentication on this
URL. Since browsers only propagate auth to resources on the same level or
below, this URL will usually be '/<something>' without a trailing slash.
@adewes
adewes / README.md
Last active August 12, 2024 20:19
Ebay Ads - Bot. Because who wants to write messages by hand...

To use this bot:

  • Download ads_bot.py and requirements.txt.
  • Type pip install -r requirements.txt to install the requirements.
  • Fill out the required information in the Python file.
  • Ideally, create a (free) Slack account and set up a web hook to receive notifications from the bot.
  • Run the script :)
  • Relax and be ready to answer incoming calls :D
@paulirish
paulirish / bling.js
Last active May 2, 2026 11:52
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };