Skip to content

Instantly share code, notes, and snippets.

@Chris2048
Chris2048 / designer.html
Created December 7, 2016 23:04
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@Chris2048
Chris2048 / designer.html
Last active April 14, 2016 23:45
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@Chris2048
Chris2048 / designer.html
Last active January 2, 2016 20:53
designer
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../paper-calculator/paper-calculator.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@Chris2048
Chris2048 / misc.py
Created November 25, 2015 23:09
Misc Code...
import os
import png
IMG_DIR = './static/img/'
for _, _, files in os.walk(IMG_DIR):
for file in files:
if file.endswith('.png'):
with open(IMG_DIR + file, 'r+') as f:
height, width = png.Reader(f).read()[:2]
f.seek(0) # reset pointer
@Chris2048
Chris2048 / gist:3f6a41fc325c488673f2
Created October 1, 2014 21:24
Controller ideas
### Controller ideas
# Subcontroller takes the lead
class Controller(object):
def go(self):
a = self.aye()
yield a
b = self.bee(a)
yield b
@Chris2048
Chris2048 / getHN
Created July 16, 2013 22:18
getHN
#!/usr/bin/python2.7
import requests
def getItems(from_date, to_date):
api_root = 'http://api.thriftdb.com/api.hnsearch.com/items/_search'
url = api_root + '?filter[fields][create_ts]=[{}+TO+{}]'.format(from_date, to_date)
payload = {
'limit': 100,
'sortby': 'create_ts desc',
@Chris2048
Chris2048 / meetuprss_to_palcal
Created April 7, 2013 16:34
meetup.com personal rss to pal calendar format
#!env python2.7
import feedparser
from datetime import datetime, timedelta
d = feedparser.parse("http://www.meetup.com/events/atom/MEETUP_RSS_URL/all")['entries']
def getDate(content):
from bs4 import BeautifulSoup
#!/usr/bin/python
#
# usage: check_lostfound.py <pathtolost+found> [make_it_so]
#
# Purpose: to find files in lost+found and trying to restore
# original files by comparing ls-md5sum-files.txt (generated by
# make-lsLR.sh
# Option make_it_so cause the data actually being written/moved
# whereas the script runs in dry mode per default.
#
#!/bin/bash
#
# Usage: ./make-lsLR.sh
#
# Purpose:
# to make a file that is parseable for recovering
# a filled /lost+found directory by parsing
# filesize, md5sum, permisions and path+filename
#
# Author: Ingo Juergensman - http://blog.windfluechter.net
@Chris2048
Chris2048 / sse example
Last active October 10, 2015 12:08
example use of sse
#!/bin/python2.7
# -`*- coding: utf-8 -*-
from gevent import monkey
monkey.patch_all()
import flask
app = flask.Flask(__name__)
app.debug = True
app.secret_key = 'asdf'