Skip to content

Instantly share code, notes, and snippets.

@mihaitodor
mihaitodor / foo_names.md
Created July 9, 2016 22:05
Map slugs to course names

https://archive.org/download/archiveteam_coursera_20160627114043/coursera_20160627114043.megawarc.warc.gz

  • bigdata = Web Intelligence and Big Data
  • clinical skills = Teaching and Assessing Clinical Skills
  • comp finance = Introduction to Computational Finance and Financial Econometrics
  • data sci = Introduction to Data Science
  • dmathgen = 离散数学概论 Discrete Mathematics Generality
  • global introuslaw = The Global Student's Introduction to U.S. Law
  • global theatre = Theatre and Globalization
  • global theatre = Theatre and Globalization
  • inforiskman = Information Security and Risk Management in Context
@boxysean
boxysean / slack.py
Last active December 4, 2020 18:47
PythonSlackOperator -- how I've integrated notifications into my PythonOperators
# airflow/plugins/slack.py
import logging
from airflow.operators.python_operator import PythonOperator
from airflow.plugins_manager import AirflowPlugin
from slackclient import SlackClient
from titan.utils import config
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
-- http://stackoverflow.com/questions/10628640/get-full-mysql-query-string-on-insert-or-update
-- SELECT info FROM INFORMATION_SCHEMA.PROCESSLIST WHERE id=CONNECTION_ID();
USE test;
CREATE TABLE test_entry (id INTEGER(10) NOT NULL DEFAULT 0);
CREATE TABLE `log_queries` (
`query_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Query ID',
`query_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT 'Query ran on time',
`query_table` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Query made on table',
@hubgit
hubgit / article-meta.txt
Last active May 30, 2018 10:39
HTML meta tags used by journal articles. ISSNs from http://www.crossref.org/titleList/ 5 DOIs of articles published in 2012 from http://search.labs.crossref.org/dois?year=2012&type=Journal+Article&rows=5&q={ISSN} 19,868 ISSNs, 96,751 files. Numbers given are number of ISSNs with that meta[name][content] (i.e. maximum is 19,868). Caveat: some of …
[citation_title] => 10193
[citation_journal_title] => 10171
[citation_volume] => 9878
[citation_pdf_url] => 9671
[citation_issue] => 9560
[citation_issn] => 9483
[citation_firstpage] => 9376
[citation_doi] => 9324
[robots] => 8939
[citation_abstract_html_url] => 8906
@PhDP
PhDP / yesod-ubuntu13.04.md
Last active December 19, 2015 02:59
Making Yesod work on Ubuntu 13.04

For a project named XXX with a postgreSQL database:

  1. $ sudo apt-get install libedit-dev libbsd-dev libgmp3-dev zlib1g-dev freeglut3-dev postgresql pgadmin3 libghc-persistent-postgresql-dev cabal-install
  2. Install all packages for 'yesod'.
  3. $ cabal update
  4. $ cd XXX && cabal install && yesod devel
# coding=UTF-8
import nltk
from nltk.corpus import brown
# This is a fast and simple noun phrase extractor (based on NLTK)
# Feel free to use it, just keep a link back to this post
# http://thetokenizer.com/2013/05/09/efficient-way-to-extract-the-main-topics-of-a-sentence/
# Create by Shlomi Babluki
# May, 2013
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@dfm
dfm / Makefile
Created August 13, 2012 19:51
ctypes chi2 example by @jrwren
libchi2.so: chi2.o
gcc -shared -Wl,-soname,libchi2.so.1 -o libchi2.so.1.0.0 chi2.o -lc
chi2.o: chi2.c
gcc -fPIC -g -c -Wall chi2.c
@ofan666
ofan666 / TDMAsolver.py
Created February 21, 2012 11:11
Tridiagonal Matrix Algorithm solver in Python, using Numpy array - http://ofan666.blogspot.com/2012/02/tridiagonal-matrix-algorithm-solver-in.html
try:
import numpypy as np # for compatibility with numpy in pypy
except:
import numpy as np # if using numpy in cpython
## Tri Diagonal Matrix Algorithm(a.k.a Thomas algorithm) solver
def TDMAsolver(a, b, c, d):
'''
TDMA solver, a b c d can be NumPy array type or Python list type.
refer to http://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm