This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import xlrd | |
def XLSDictReader(f, sheet_index=0): | |
data = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) | |
book = xlrd.open_workbook(file_contents=data) | |
sheet = book.sheet_by_index(sheet_index) | |
def item(i, j): | |
return (sheet.cell_value(0,j), sheet.cell_value(i,j)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abc | |
from enum import unique | |
import json | |
import datetime | |
import dataclasses | |
from typing import Optional | |
from sqlalchemy import Column, Integer, String, DateTime, JSON, Index, select, create_engine, and_ | |
from sqlalchemy.dialects.postgresql import JSONB | |
from sqlalchemy.orm import registry, sessionmaker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
class AnyDict(dict): | |
""" | |
>>> AnyDict(foo=1) == {"foo": 1, "bar": 2} | |
True | |
>>> AnyDict(foo=2) == {"foo": 1, "bar": 2} | |
False | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Video = Backbone.Model.extend({}); | |
var VideoList = Backbone.Collection.extend({ | |
model: Video, | |
url: '/videos' | |
}); | |
var VideoPlayerView = Backbone.View.extend({ | |
id: 'video-player', | |
className: 'video-player', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UTCDateTime(TypeDecorator): | |
impl = DateTime | |
def convert_bind_param(self, value, engine): | |
return value | |
def convert_result_value(self, value, engine): | |
return UTC.localize(value) | |
class StampedMixin(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SAFE = True | |
MASK = "*" | |
def mask(val): | |
return MASK * len(val) | |
def value(val): | |
return mask(val) if SAFE else val |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Build failure | |
if: failure() | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
SLACK_CHANNEL: ... | |
run: | | |
curl -X POST \ | |
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \ | |
-d channel=$SLACK_CHANNEL \ | |
-d text='[${{ github.repository }}] ${{ github.event.ref }} *FAILED*' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python maze.py | |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
## # # # # ####### # ### # ### # # # # # # ### # # # ### ### ### ##### ### # ### # ##### ### ########### # # # # # # ### | |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
## # # ### # # # ##### # # # # # ##### ### # ### ##### # # ### ##### ##### ####### # # # # # ### ### # # # # # ### # # # | |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # | |
## ##### # ### # ### # ### ##### # # ##### # # # ##### ### # ####### # # ##### # # ############# # ##### ##### ######### | |
# # # # # # # # # # # # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var postgres = require('/home/marc/Source/node_postgres/postgres'), | |
irc = require('irc'), | |
http = require('http'), | |
url = require('url'), | |
querystring = require('querystring'), | |
util = require('util'); | |
function DB(conn) { | |
this.db = postgres.createConnection(conn); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import openpyxl | |
def XLSXDictReader(f): | |
book = openpyxl.reader.excel.load_workbook(f) | |
sheet = book.get_active_sheet() | |
rows = sheet.get_highest_row() | |
cols = sheet.get_highest_column() |