Skip to content

Instantly share code, notes, and snippets.

@mooz
mooz / extract_slide.py
Last active October 5, 2023 16:00
Extract a slide image from a photo
# -*- coding: utf-8 -*-
# ============================================================ #
# 写真からスライド領域を切り出して保存。透視変換もおこなう
#
# Usage: python extract_slide.py YOUR_PHOTO
#
# ============================================================ #
import cv2
@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@yllan
yllan / nginx.conf
Created February 5, 2013 07:55
設定 nginx 使用 server sent event
location xxxx {
proxy_pass http://localhost:9000;
proxy_buffering off;
proxy_cache off;
proxy_redirect off;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@kui
kui / rbindkeys.desktop
Last active October 6, 2015 03:27
rbindkeys スタータースクリプト。本当だったらこれ相等の機能を、rbindkeys に組み込む必要あり。
[Desktop Entry]
Encoding=UTF-8
Name=rbindkeys
Comment=key remapper
#Icon=blueman
Exec=gksudo /home/kui/.local/bin/start_rbindkeys.sh
Terminal=false
Type=Application
Categories=
@entaroadun
entaroadun / gist:1653794
Created January 21, 2012 20:10
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@daspilker
daspilker / get_access_token.js
Created October 4, 2011 21:38
Node.js script to retrieve an OAuth 2.0 access token
var express = require('express');
var oauth = require('oauth');
var oa;
var app = express.createServer();
app.get('/', function (req, res) {
res.end('<!DOCTYPE html><meta charset=utf-8><form action=/authorize><label>Client ID: <input type=text name=client_id required autofocus></label><br><label>Client Secret: <input type=text name=client_secret required></label><br><label>Scope: <input type=text name=scope required></label><br><input type=submit>');
});
app.get('/authorize', function (req, res) {
@958
958 / keybind-helper.ks.js
Last active September 26, 2015 02:47
[keysnail]入力中のキーに続くキーバインドを表示する
let PLUGIN_INFO =
<KeySnailPlugin>
<name>Keybind helper</name>
<description>I display a key to push next</description>
<description lang="ja">入力中のキーに続くキーバインドを一覧表示する</description>
<author>958</author>
<license>MIT</license>
<updateURL>https://gist.github.com/958/1026637/raw/keybind-helper.ks.js</updateURL>
<iconURL>https://sites.google.com/site/958site/Home/files/keybind-helper.ks.png</iconURL>
<version>0.0.3</version>
(defun my-reb-query-replace-regexp ()
"Call `query-replace-regexp' with current regexp of RE-builder"
(interactive)
(reb-update-regexp)
(let ((re (reb-target-binding reb-regexp)))
(flet ((query-replace-read-from
(prompt regexp-flag)
;; body
re))
(pop-to-buffer reb-target-buffer)