Skip to content

Instantly share code, notes, and snippets.

View yaodong's full-sized avatar

Yaodong Zhao yaodong

View GitHub Profile
@EntropyWorks
EntropyWorks / add-ssh-keys.yml
Last active March 29, 2022 21:04
Add all the hosts from your ansible inventory to your .ssh/known_hosts and also use ssh-copy-id to add keys to the hosts
---
# Original idea found at http://stackoverflow.com/a/39083724
#
# ansible -i inventory.ini add-ssh-keys.yml
#
- name: Store known hosts of 'all' the hosts in the inventory file
hosts: localhost
connection: local
vars:
ssh_known_hosts_command: "ssh-keyscan -T 10"
diff --git a/assets/index.html b/assets/index.html
index fe3fa40..220421c 100644
--- a/assets/index.html
+++ b/assets/index.html
@@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" type="text/css" href="trix.css">
<script type="text/javascript" src="trix.js"></script>
+ <script type="text/javascript" src="people_attachments.js"></script>
</head>
@prenagha
prenagha / lbdist.sh
Last active January 27, 2022 17:30
Launchbar Action package script
#!/bin/bash
#
# code sign and package each launchbar action then push
# to dropbox folder for public distribution
#
# first make sure everything is compiled
# see https://gist.github.com/prenagha/404284fee1b8ff86aec5
~/bin/compile-applescript.sh
if [ $? -ne 0 ]
@ulissesalmeida
ulissesalmeida / polymorphic_has_many.rb
Last active August 29, 2015 14:10
Polymorphic has_many/has_one with custom columns.
unless File.exists? 'Gemfile'
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails' # Failing
# gem 'rails', :git => 'https://github.com/ulissesalmeida/rails.git', :branch => 'polymorphic-has-one-many-custom-foreign-type'
gem 'sqlite3'
GEMFILE
system 'bundle --quiet'
end

现整理收集C++世界里那些“牛人”的个人博客。凡三类:一是令人高山仰止的大牛,对C++语言本身产生过深远的影响的人;二是C++运用炉火纯青的高手,有原创性的技术干货;三是中文世界里的C++牛人。

C++大牛的博客

@hest
hest / gist:8798884
Created February 4, 2014 06:08
Fast SQLAlchemy counting (avoid query.count() subquery)
def get_count(q):
count_q = q.statement.with_only_columns([func.count()]).order_by(None)
count = q.session.execute(count_q).scalar()
return count
q = session.query(TestModel).filter(...).order_by(...)
# Slow: SELECT COUNT(*) FROM (SELECT ... FROM TestModel WHERE ...) ...
print q.count()
@clarkbw
clarkbw / users.yml
Created January 14, 2014 14:06
Devise user fixture for testing rails with users. confirm* items are only required if you've set :confirmable in your model.
bryan:
email: clarkbw@example.com
encrypted_password: <%= User.new.send(:password_digest, '1234567890') %>
confirmed_at: <%= Time.zone.now - 1.hour %>
confirmation_sent_at: <%= Time.zone.now - 2.hours %>
@chrisyip
chrisyip / for_global.txt
Last active February 19, 2020 10:26
SSLedge bypass list
127.0.0.1, anrdoezrs.net, *.anrdoezrs.net, w3ctech.com, *.w3ctech.com, hdtdxp.com, *.hdtdxp.com, uuzuonline.com, *.uuzuonline.com, luzhou.net, *.luzhou.net, cjphr.com, *.cjphr.com, fridaying.com, *.fridaying.com, bjokli.com, *.bjokli.com, 93txt.com, *.93txt.com, robotplayer.com, *.robotplayer.com, upai99.com, *.upai99.com, gemsky.net, *.gemsky.net, 00base.com, *.00base.com, mebi9t.com, *.mebi9t.com, is686.com, *.is686.com, cdncache.org, *.cdncache.org, sucaitianxia.com, *.sucaitianxia.com, 89178.com, *.89178.com, 5dmail.net, *.5dmail.net, oy66.com, *.oy66.com, shanghaining.com, *.shanghaining.com, book118.com, *.book118.com, zsbeike.com, *.zsbeike.com, hunantv.com, *.hunantv.com, ylunion.com, *.ylunion.com, mysilu.com, *.mysilu.com, 0737mp.com, *.0737mp.com, 37cu.com, *.37cu.com, longre.com, *.longre.com, yanzheng.com, *.yanzheng.com, lifeyoyo.com, *.lifeyoyo.com, wulinyingxiong.net, *.wulinyingxiong.net, yong9.net, *.yong9.net, communicatte.com, *.communicatte.com, ok92.net, *.ok92.net, junshishu.com, *.juns
@plentz
plentz / nginx.conf
Last active April 24, 2024 11:15
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@ib-lundgren
ib-lundgren / github_flask_oauth2.py
Created September 10, 2013 10:53
Example of how to use Flask with requests-oauthlib to fetch a GitHub user profile using an OAuth 2 token.
from requests_oauthlib import OAuth2Session
from flask import Flask, request, redirect, session, url_for
from flask.json import jsonify
import os
app = Flask(__name__)
# This information is obtained upon registration of a new GitHub
client_id = "<your client key>"