Skip to content

Instantly share code, notes, and snippets.

import time
import zlib
from threading import Lock, Thread
from typing import (
Literal,
Optional,
Protocol,
Sequence,
Type,
TypeAlias,
@cliffxuan
cliffxuan / surfingkeys.js
Last active October 5, 2024 21:14
surfingkeys config
api.map('gt', 'T');
api.unmapAllExcept(['E','R','T'], /mail.google.com|gmail.com|twitter.com|youtube.com/);
api.unmapAllExcept([], /tldraw.com|tradingview.com/);
api.Front.registerInlineQuery({
url: function(q) {
return `http://dict.youdao.com/w/eng/${q}/#keyfrom=dict2.index`;
},
parseResult: function(res) {
var parser = new DOMParser();
var doc = parser.parseFromString(res.text, "text/html");
import logging
from contextlib import ContextDecorator
format = '%(asctime)s - %(levelname)s - %(message)s'
ch = logging.StreamHandler()
ch.setFormatter(logging.Formatter(format))
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
logger.addHandler(ch)

Get github repositories for an organisation

requirement

  • python

install

  • pip install requests
We can't make this file beautiful and searchable because it's too large.
AB1 0AA
AB1 0AB
AB1 0AD
AB1 0AE
AB1 0AF
AB1 0AG
AB1 0AJ
AB1 0AL
AB1 0AN
AB1 0AP
@cliffxuan
cliffxuan / Responsive-flip-menu.-Pure-CSS..markdown
Last active August 29, 2015 14:19
Responsive flip menu. Pure CSS.
This file has been truncated, but you can view the full file.
A
a
aa
aal
aalii
aam
Aani
aardvark
aardwolf
Aaron
#!/bin/sh
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
echo "checkout submodules"
git submodule init
git submodule update
echo "symlink .vim"
if [ -d "$HOME/.vim" ]
then
import unittest
import sys
code_map = {
'a' : '2',
'b' : '22',
'c' : '222',
'd' : '3',
'e' : '33',
'f' : '333',
@cliffxuan
cliffxuan / introspect_primary_key.py
Created November 10, 2012 21:43
Introspect constraint on table's primary key in the entire database
import unittest
import itertools
import sqlalchemy as sa
from sqlalchemy import Table, Column, String, ForeignKey
from newman.schema.branch import tables
class Introspector(object):
def __init__(self, metadata):
self.metadata = metadata