Skip to content

Instantly share code, notes, and snippets.

View emptymalei's full-sized avatar
📡
sending EM waves to Mars

LM emptymalei

📡
sending EM waves to Mars
View GitHub Profile
@lislis
lislis / event.md
Last active October 5, 2021 11:52
Hugo ical template

title: "Event title" slug: event-title date: "2020-03-02T19:30:00+01:00" summary: "the standard says this should be less than 75 characters!" end: "2020-03-02T22:00:00+01:00" location: "Event location if known" organizer: name: "Your name" email: "your@email.com"

@bradmontgomery
bradmontgomery / single_dispatch_example.py
Created August 23, 2016 17:08
Example of single dispatch in python. This is seriously cool stuff.
"""
Playing with python's single dispatch.
See: https://hynek.me/articles/serialization/
See also PEP 443: https://www.python.org/dev/peps/pep-0443/
"""
from datetime import datetime
from functools import singledispatch
@ahgittin
ahgittin / jsonball.rb
Created February 23, 2012 21:57
a jekyll tag to parse json files and objects for use as maps subsequently
require 'json'
# JSON parser tag, creating map for use in jekyll markdown
# Alex.Heneveld @ Cloudsoft Corp (remove spaces and add the .com)
# Released under APL 2.0
# usage: {% jsonball varname from TYPE PARAM %}
#
# where TYPE is one of {data,var,file,page}, described below
@caiotaniguchi
caiotaniguchi / lollipop_plotly.py
Last active January 18, 2022 16:19
Plotting Lollipop Charts with Plotly
import numpy as np
import plotly.offline as pyo
import plotly.graph_objs as go
# Generate a random signal
np.random.seed(42)
random_signal = np.random.normal(size=100)
# Offset the line length by the marker size to avoid overlapping
marker_offset = 0.04
@JungeAlexander
JungeAlexander / import-package-from parent.py
Created November 27, 2014 17:22
Import modules from parent folder in Python
# From http://stackoverflow.com/a/11158224
# Solution A - If the script importing the module is in a package
from .. import mymodule
# Solution B - If the script importing the module is not in a package
import os,sys,inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
@sstirlin
sstirlin / number_figures_in_sphinx.rst
Last active April 18, 2022 20:36
How to number figures in Sphinx. How to do subfigures

Numbering figures in Sphinx. Subfigures as a bonus

Although the .. figure:: and .. image:: directives in reStructuredText are much easier than their LaTex counterparts, they are also lacking some critical features:

  • no automatic numbering
  • no subfigures
@deepak365
deepak365 / How to install redash in mac.
Last active May 27, 2022 05:38
How to install redash in mac.
What is redash?
Redash is database viewer included BI tool inside. Redash has support for querying multiple databases, including: Redshift, Google BigQuery, PostgreSQL, MySQL, Graphite, Presto, Google Spreadsheets, Cloudera Impala, Hive and custom scripts.
Prerequisite :
1. Install docker
2. Install git
git clone https://github.com/getredash/redash.git
docker-compose -f docker-compose.production.yml run --rm server create_db
docker-compose -f docker-compose.production.yml up
window_size = 2
idx_pairs = []
# for each sentence
for sentence in tokenized_corpus:
indices = [word2idx[word] for word in sentence]
# for each word, threated as center word
for center_word_pos in range(len(indices)):
# for each window position
for w in range(-window_size, window_size + 1):
context_word_pos = center_word_pos + w
/**
* Fetching data from BigQuery and present it in our sheet
* Author: Ido Green
* Date: 14/12/2013
*
* See: https://greenido.wordpress.com/2013/12/16/big-query-and-google-spreadsheet-intergration/
* Misc: https://developers.google.com/bigquery/
*/
//
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.