Skip to content

Instantly share code, notes, and snippets.

@dsaiztc
dsaiztc / gmail_bookmarklet.js
Created Jun 13, 2022 — forked from rondevera/gmail_bookmarklet.js
Gmail bookmarklet: For quickly e-mailing the current page's URL (and the selected text, if any) via Gmail.
View gmail_bookmarklet.js
/*
Gmail bookmarklet
rondevera.com
For quickly e-mailing the current page's URL (and the selected text, if any)
via Gmail.
Usage:
- Create a new item in your bookmark bar with the name "Gmail" (or just "Gm",
or your favorite Unicode character), and the code below as the location.
@dsaiztc
dsaiztc / titleUrlMarkdownClip.js
Created Jun 13, 2022 — forked from idelem/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
View titleUrlMarkdownClip.js
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
View docstring_google.py
# -*- coding: utf-8 -*-
"""Example Google style docstrings.
This module demonstrates documentation as specified by the `Google Python
Style Guide`_. Docstrings may extend over multiple lines. Sections are created
with a section header and a colon followed by a block of indented text.
Example:
Examples can be given using either the ``Example`` or ``Examples``
sections. Sections support any reStructuredText formatting, including
View barcelona.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View cross_platform_virtualenv.md

Cross platform interface for virtualenv

Unless you use some Windows specific libraries; or an alternate Python implementation (like IronPython), there is nothing to worry about.

Many people (including myself) use Windows for development and deploy on Linux for production and use virtualenv for this purpose. It is designed to make your environment portable.

You don't push the entire virtualenv to Linux.

Once you have your virtual environment ready and your code is working, you should freeze the requirements for your application:

@dsaiztc
dsaiztc / postgres-cheatsheet.md
Created May 3, 2020 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@dsaiztc
dsaiztc / gzip_str.py
Created Mar 13, 2020 — forked from Garrett-R/gzip_str.py
Demo of how to gzip and gunzip a string in Python 3
View gzip_str.py
import gzip
import io
def gzip_str(string_):
out = io.BytesIO()
with gzip.GzipFile(fileobj=out, mode='w') as fo:
fo.write(string_.encode())
bytes_obj = out.getvalue()
View git_advanced.md
@dsaiztc
dsaiztc / R.md
Last active Nov 26, 2019
R Cheatsheet.
View R.md

R Cheatsheet

General

  • getwd() Get Working Directory
  • setwd('~/Downloads') Set Working Directory
  • ls() List variables on Environment
  • dir() List directories on Working Directory
  • list.files() List files on Working Directory
  • rm('variable1') Remove variable1 from Environment
  • rm(list = ls())Remove all variables on Environment
  • identical(data1, data2)