Skip to content

Instantly share code, notes, and snippets.

@lambdamusic
lambdamusic / define.py
Last active February 15, 2023 14:52
Access osx dictionary in python
#!/usr/bin/env python
"""
# Version
2021-08-31
# Tested on
Python 3.9
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 9, 2024 19:52
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@disusered
disusered / profiler
Created July 13, 2015 05:06
Profiling Neovim startup
#!/bin/bash
iterations=10
# -----------------------------------------------------------------------------
# Create array of results
declare -a results
for i in $(seq 1 $iterations);
operator infix => { associativity left }
func => <K : Hashable, V>(key: K, value: V) -> (K, V) {
return (key, value)
}
let pairs: (String, Int)[] = [
"e" => 10,
"t" => 7,
"i" => 2
]
@evi1m0
evi1m0 / PicConverText.py
Last active December 5, 2023 03:08
12306 新版验证码识别脚本 (已失效)
#!/usr/bin/env python
# coding=utf8
# author=evi1m0
# website=linux.im
'''
12306 Captcha Picture:
author: Evi1m0@20150316
1. Download Captcha
2. Pic Conver Text
class Pipe(object):
def __init__(self, func):
self.func = func
def __ror__(self, other):
def generator():
for obj in other:
if obj is not None:
yield self.func(obj)
return generator()
@ericdke
ericdke / notification.swift
Created October 10, 2014 21:01
Deliver an OSX notification with Swift
func showNotification() -> Void {
var notification = NSUserNotification()
notification.title = "Test from Swift"
notification.informativeText = "The body of this Swift notification"
notification.soundName = NSUserNotificationDefaultSoundName
NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notification)
}
//showNotification()
@viko16
viko16 / formatTime.js
Created August 20, 2014 17:45
人性化时间处理 #javascript
/**
* 格式化时间戳为人性化的时间
* @param {String} publishTime 时间戳
* @return {String} 人性化时间
*/
function formatTime(publishTime) {
var d_minutes, d_hours, d_days;
var timeNow = parseInt(new Date().getTime() / 1000, 10);
var d;
@typehorror
typehorror / Flask-SQLAlchemy Caching.md
Last active February 15, 2024 14:44
Flask SQLAlchemy Caching

Flask-SQLAlchemy Caching

The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.

Usage

retrieve one object

# pulling one User object

user = User.query.get(1)

@HamptonMakes
HamptonMakes / RBResizer.swift
Created June 27, 2014 14:45
Swift Image Resizer
//
// RBResizer.swift
// Locker
//
// Created by Hampton Catlin on 6/20/14.
// Copyright (c) 2014 rarebit. All rights reserved.
//
import UIKit