Skip to content

Instantly share code, notes, and snippets.

View eliasdorneles's full-sized avatar

Elias Dorneles eliasdorneles

View GitHub Profile
@eliasdorneles
eliasdorneles / just_a_button.py
Last active November 26, 2015 09:07
For Those Times When You Just Want a Button
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
For those times when you just want a button.
Run and notice the new icon in your notifications area.
Inspired by: https://glyph.twistedmatrix.com/2015/07/just-a-button.html
"""
@eliotsykes
eliotsykes / git-aware-bash-prompt.md
Last active April 28, 2023 12:18
Git Aware Bash Prompt
@knu2xs
knu2xs / python-random-date.py
Last active July 17, 2023 14:15
Use python function to generate random date in given calendar year.
# import modules
import random
import datetime
# create function accepting a single parameter, the year as a four digit number
def get_random_date(year):
# try to get a date
try:
return datetime.datetime.strptime('{} {}'.format(random.randint(1, 366), year), '%j %Y')
@candidtim
candidtim / myappindicator_v4.py
Last active July 15, 2021 21:40
Minimal Ubuntu AppIndicator in Python, with custom icon and a "Quit" menu item
import os
import signal
from gi.repository import Gtk as gtk
from gi.repository import AppIndicator3 as appindicator
APPINDICATOR_ID = 'myappindicator'
def main():
indicator = appindicator.Indicator.new(APPINDICATOR_ID, os.path.abspath('sample_icon.svg'), appindicator.IndicatorCategory.SYSTEM_SERVICES)
indicator.set_status(appindicator.IndicatorStatus.ACTIVE)
@eliasdorneles
eliasdorneles / play_song.py
Last active November 22, 2016 19:58
Challenge: guess the song by just reading the code (before playing it)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import time
VERBOSE = False
def wait(seconds):
from lxml import etree
CLASS_EXPR = "contains(concat(' ', normalize-space(@class), ' '), ' {} ')"
def has_class(context, *classes):
"""
This lxml extension allows to select by CSS class more easily
@hzopak
hzopak / gist:9573928
Last active May 27, 2018 09:43
nginx config for scrapyd deployment to implement basic auth protection
# Scrapyd local proxy for basic authentication.
# Don't forget iptables rule.
# iptables -A INPUT -p tcp --destination-port 6800 -s ! 127.0.0.1 -j DROP
server {
listen 6801;
location ~ /\.ht {
deny all;
}
@XVilka
XVilka / TrueColour.md
Last active April 8, 2024 14:02
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@sloria
sloria / bobp-python.md
Last active April 17, 2024 09:35
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@audreyfeldroy
audreyfeldroy / pypi-release-checklist.md
Last active February 23, 2023 15:03
My PyPI Release Checklist
  • Update HISTORY.md
  • Commit the changes:
git add HISTORY.md
git commit -m "Changelog for upcoming release 0.1.1."
  • Update version number (can also be minor or major)
bumpversion patch