Skip to content

Instantly share code, notes, and snippets.

View shohei's full-sized avatar

Shohei Aoki shohei

View GitHub Profile
@acwright
acwright / gist:1944639
Created February 29, 2012 21:40
Sinatra / ActionMailer / Sendgrid / Heroku
require 'sinatra'
require 'action_mailer'
class Mailer < ActionMailer::Base
def contact
mail(
:to => "test@example.com",
:from => "test@example.com",
:subject => "Test") do |format|
format.text
@satomacoto
satomacoto / extract_youtube_videoid.py
Last active February 23, 2019 11:45
Extract youtube video id from html
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# extract YouTube videoids from html
import re
import json
import urllib2
from BeautifulSoup import BeautifulSoup
def get_videoids(url):
@jkp
jkp / websocketserver.py
Created July 18, 2012 13:28
A simple WebSockets server with no dependencies
import struct
import SocketServer
from base64 import b64encode
from hashlib import sha1
from mimetools import Message
from StringIO import StringIO
class WebSocketsHandler(SocketServer.StreamRequestHandler):
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
@ponkore
ponkore / clojure-reader-macro.md
Created December 3, 2012 15:32
Clojure のリーダーマクロについて (lisp reader macro advent calendar 2012 の記事です)。

Clojure のリーダーマクロについて

この記事は、lispリーダーマクロアドベントカレンダー の4日目の記事です。 タイトルにある通り、Clojure でのリー ダーマクロについて取り扱います(対象とする Clojure のバージョンは 1.4)。

はじめに

@kohyama
kohyama / incanter-interns.md
Last active April 3, 2017 14:01
Incanter の関数・マクロまとめ

incanter.core

与えられた数について

factorial: 階乗 (引数は非負整数)
gamma: ガンマ関数 (階乗の拡張. 引数 n が 1以上の整数ならば, n - 1 の階乗に等しい)

与えられたシーケンスについて

sum: 総和
sum-of-squares: 平方の総和
prod: 総積

atom-shellとNode-Webkitとの技術的な違い

Node-Webkitのように、atom-shwllはJavaScriptとHTMLでデスクトップアプリケーションを書くダメのプラットフォームを提供します。そしてシステムのローレベルな権限へのアクセスも可能です。

しかしながら、そこには根本的な違いがあって、atom-shellはNode-Webkitとは完全に別なプロダクトになっています。

1. Entry of application

Node-WebkitはアプリケーションのエントリポイントがWebページで、package.jsonにメインページを指定します。そしてそれがアプリケーションのメインウィンドウとしてブラウザで開かれます。

@SevenW
SevenW / HTTPWebSocketsHandler.py
Last active October 23, 2023 13:10
HTTPWebSocketsHandler extends SimpleHTTPServer with WebSockets enabling the use of HTTP and WebSockets throught the same port
'''
The MIT License (MIT)
Copyright (C) 2014, 2015 Seven Watt <info@sevenwatt.com>
<http://www.sevenwatt.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@nikhiljha
nikhiljha / AddCookiesInterceptor.java
Created July 29, 2016 04:35
Retrofit2/OkHttp3 Cookies (Drag and Drop, One Size Fits 99%)
// Original written by tsuharesu
// Adapted to create a "drop it in and watch it work" approach by Nikhil Jha.
// Just add your package statement and drop it in the folder with all your other classes.
import android.content.Context;
import android.preference.PreferenceManager;
import android.util.Log;
import java.io.IOException;
import java.util.HashSet;
@fpgadeveloper
fpgadeveloper / FIR Acceleration on PYNQ.ipynb
Last active February 17, 2024 21:46
How to accelerate a Python function with PYNQ
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.