Skip to content

Instantly share code, notes, and snippets.

# AND OR とかも直感的に使える
from sqlalchemy.sql.expression import *
# AND
Entry.query.filter(and_(Entry.id == 1, Entry.text == "entry")).all()
# => SELECT * FROM entries WHERE entries.id = 1 AND entries.text = "entry"
# OR
Entry.query.filter(or_(Entry.id == 1, Entry.text == "entry")).all()
# => SELECT * FROM entries WHERE entries.id = 1 OR entries.text = "entry"
@tell-k
tell-k / paramiko_proxycommand_sample.py
Last active April 14, 2021 10:07
paramikoのProxyCommandのサンプル
#!/usr/bin/env python
#-*- coding:utf8 -*-
# paramiko の ProxyCommandの Sample
# -------------------------------------------------
#
# ~/.ssh/config
#
# Host proxy-server
# User hoge
@tell-k
tell-k / fixed_element_with_remove_addressbar.html
Created February 14, 2013 05:30
mediaクエリーで、アドレスバーを消す前と、消した後で要素の位置(高さ)を固定にしたい時のサンプル
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<style>
/*
初期表示が height: 546px
アドレスバーを消すと height: 615px になる場合
# -*- coding: utf-8 -*-
"""
Connpass API Wrapper
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Requirement
- Requests (http://docs.python-requests.org/en/latest/)
See Also
class Point
attr_accessor :user
def initialize(user)
@user = user
end
def calc_point_num
unless self.user.point_num
return 101
@tell-k
tell-k / 0_reuse_code.js
Created February 11, 2014 10:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tell-k
tell-k / gist:c7552ef551f06620e2f029f1495fe173
Last active April 14, 2018 05:03
ブロック内のコードをスキップできる + スコープを共有しない with statetment
# 1. ブロック内のコードを実行しない with -------
# refs http://stackoverflow.com/questions/12594148/skipping-execution-of-with-block
import sys
import inspect
class SkipContext:
def __enter__(self):
# 1. SkipContextの外側のframeを取得
self.frame, _, _, _, _, _ = inspect.getouterframes(inspect.currentframe())[1]