Skip to content

Instantly share code, notes, and snippets.

Francesco Frassinelli frafra

Block or report user

Report or block frafra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET thumbnail_url = replace(thumbnail_url, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_maplayer SET ows_url = replace(ows_url, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_maplayer SET layer_params = replace(layer_params, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_maplayer SET source_params = replace(source_params, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE maps_mapsnapshot SET config = replace(config, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET supplemental_information = replace(supplemental_information, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE base_resourcebase SET csw_anytext = replace(csw_anytext, '$1', '$2')"
sudo -u postgres psql -d geonode -c "UPDATE django_site SET domain = replace(domain, '$1', '$2')"
View rename master to gh-pages
# Github's web hosting looks for a branch called "gh-pages"
# Git by names the default branch "master" so we need rename
# it to "gh-pages" so that Github can find the website files.
# In terminal/cmd
git checkout -b gh-pages # Create a new branch called gh-pages
git push origin gh-pages # Push the gh-pages repo to github
# On Github
Settings (Repo settings) --> Branches --> Default Branch --> gh-pages --> Update
yakky /
Last active Mar 16, 2018
Micro hello world Python Web Framework Royal Rumble @PyCon 7
import django
DEBUG, ROOT_URLCONF, DATABASES, SECRET_KEY = 1, 'pico', {'default': {}}, 'p'
urlpatterns = [django.conf.urls.url(r'^(?P<name>\w+)?$', lambda request,
name: django.http.HttpResponse('hello %s!' % (name or 'world')))]

Avoid jQuery When Possible

jQuery does good jobs when you're dealing with browser compatibility. But we're living in an age that fewer and fewer people use old-school browsers such as IE <= 7. With the growing of DOM APIs in modern browsers (including IE 8), most functions that jQuery provides are built-in natively.

When targeting only modern browsers, it is better to avoid using jQuery's backward-compatible features. Instead, use the native DOM API, which will make your web page run much faster than you might think (native C / C++ implementaion v.s. JavaScript).

If you're making a web page for iOS (e.g. UIWebView), you should use native DOM APIs because mobile Safari is not that old-school web browser; it supports lots of native DOM APIs.

If you're making a Chrome Extension, you should always use native APIs, not only because Chrome has almost the latest DOM APIs available, but this can also avoid performance issue and unnecessary memory occupation (each jQuery-driven extension needs a separate

apk /
Created Apr 18, 2012
A web socket server as a bash script.
# WebSocket shell, start & browse to http://<Host>:6655/
# Requires bash 4.x, openssl.
# Author: (which isn't me, apk)
coproc d { nc -l -p 6656 -q 0; }
nc -l -p 6655 -q 1 > /dev/null <<-ENDOFPAGE
HTTP/1.1 200 OK
<html><head><script language="javascript">
var url = location.hostname + ':' + (parseInt(location.port) + 1);

Google Speech To Text API

Base URL:
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

The client's name you're connecting from. For spoofing purposes, let's use chromium

Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

You can’t perform that action at this time.