Skip to content

Instantly share code, notes, and snippets.

@denilsonsa
denilsonsa / watch_site.py
Last active May 23, 2023 22:01
watch_site.py - Easily watch a site for changes...
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4 sw=4 et
####################################################################################
# The most up-to-date version is available at: #
# https://github.com/denilsonsa/small_scripts/blob/master/watch_website_tkinter.py #
# #
# The code in this Gist is old and obsolete. #
####################################################################################
@denilsonsa
denilsonsa / pppt-BR1.txt
Last active November 22, 2016 19:50
This file should be placed at `/sdcard/svox/classic/pt-bR/pppt-BR1.txt` on your Android device. It contains many Portuguese pronunciation corrections for use with [SVOX Br. Portug. Luciana Voice][1]. This file should use unix-style newlines (the default style for Linux and Mac OS X editors), and should be encoded in UTF-8. This file is also avai…
NETWORK USER_EXTENSION_NETWORK
NETWORKCOST = -10001
PRODUCTIONS
USER_STRINGS =
L<'Apple',ci> Out<'épou'>
| L<'aquele',ci> Out<'aquêle'>
| L<'back',ci> Out<'bék'>
| L<'backspace',ci> Out<'békspeice'>
| L<'Bluetooth',ci> Out<'Blutuf'>
| L<'byte',ci> Out<'baite'>
@denilsonsa
denilsonsa / cell-color-based-on-value.js
Last active December 26, 2015 10:49
Sets the cell background color to red-yellow-green based on its value. Used on this Google Spreadsheet: https://docs.google.com/spreadsheet/ccc?key=0AvfBqhRA8IzYdEJfNl83R2w0OGRVZUNFaWxlRFlEVGc
// cell-color-based-on-value.gs
//
// For more information on using the Spreadsheet API, see
// https://developers.google.com/apps-script/service_spreadsheet
// Returns a linear interpolation of y1,y2 based on x value between x1,x2.
function linearInterp(x, x1, x2, y1, y2) {
if (x <= x1) return y1;
if (x >= x2) return y2;
return y1 + (y2 - y1) * (x - x1) / (x2 - x1);
@denilsonsa
denilsonsa / digit9brazil.js
Last active November 19, 2016 08:16
Google Apps Script to find mobile phone numbers meeting certain criteria (look inside "updateNumber()" and "fixNumbersFromGoogleContacts()" for details) and add a ninth digit to them. Scans all phone numbers in your Google Contacts, using official Google APIs. Also includes a simple and ugly UI for the most basic usage.
// digit9brazil.gs
// Google Apps Script
//
// Objective:
// Find mobile phone numbers meeting certain criteria (look inside "updateNumber()" and
// "fixNumbersFromGoogleContacts()" for details) and add a ninth digit to them.
//
// Live link:
// https://script.google.com/macros/s/AKfycbzWlGLgZmA0lygkwMLp3p6RrRFIbBfVdKGXaUAcJCJo59R492E/exec
//
@denilsonsa
denilsonsa / url_to_drive.js
Last active December 18, 2022 18:32
Google Apps Script to upload a file from an URL directly to Google Drive.
// url_to_drive.gs
// Google Apps Script
// Allows uploading a URL directly to Google Drive.
//
// Live link:
// https://script.google.com/macros/s/AKfycbzvhbHS4hnWPVBDHjQzZHA0qWq0GR-6hY7TbYsNto6hZ0MeAFZt/exec
//
// Source-code:
// https://gist.github.com/denilsonsa/8134679
// https://script.google.com/d/1Ye-OEn1bDPcmeKSe4gb0YSK83RPMc4sZJt79SRt-GRY653gm2qVUptoE/edit
@denilsonsa
denilsonsa / careers-2.0-stackoverflow.svg
Created February 5, 2014 21:18
Careers 2.0 (by Stack Overflow) logo in SVG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@denilsonsa
denilsonsa / timezone_and_django.py
Last active August 29, 2015 14:03 — forked from anonymous/dpaste.de_snippet.py
datetime object, when rendered to Django template, was always 6 minutes off.
class LocalDateTimeField(with_metaclass(models.SubfieldBase, models.DateTimeField)):
'''A hack/workaround version of DateTimeField that considers the datetime
from the database as local time.
'''
def to_python(self, value):
from django.utils.dateformat import format
value = models.DateTimeField.to_python(self, value)
if isinstance(value, datetime):
print('-' + repr(value))
print(strftime('%Y-%m-%d %H:%M:%S.%f', value.timetuple()))
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Live demo of Nosy Facetype by Rory Harnden</title>
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,400italic' rel='stylesheet' type='text/css'>
<style type="text/css">
@font-face {
font-family: "Nosy";
src: url(NOSY_Facetype_by_Rory_Harnden.otf) format("opentype");
@denilsonsa
denilsonsa / Python Virtual Environments on Debian and Ubuntu.md
Last active December 1, 2016 06:25
Python Virtual Environments on Debian and Ubuntu

pyvenv-3.3 (Ubuntu 13.10, also Debian)

Symptoms

pyvenv-3.3 venvdir
venvdir/bin/python -c 'import sys; print(sys.path)'
# This should print the venvdir in sys.path.

But in buggy Ubuntu/Debian, it doesn't.

@denilsonsa
denilsonsa / README.md
Last active December 3, 2023 04:56 — forked from a9cQ0Q/README.md

slow

This bash script offers quick shortcuts to simulate slower network connections. It is useful when you need to simulate a wireless network on a Linux network server, especially when you are using a virtual machine guest on your local machine or in the cloud.

slow 3G                   # Slow network on default eth0 down to 3G wireless speeds
slow 3G -l 600ms -p 10%   # slow network on eth0 and setup latency to 600ms packetloss to 10%
slow reset                # Reset connection for default eth0 to normal
slow vsat --latency=500ms # Simulate satellite internet  with a high latency

slow dsl -b 1mbps # Simulate DSL with a slower speed than the default