Skip to content

Instantly share code, notes, and snippets.

@laiso
laiso / hatenaoauth_example.py
Last active August 10, 2022 13:29
Pythonではてなの OAuth 対応 API を利用する
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
フレームワークとして Flask(http://flask.pocoo.org/) を、OAuth ライブラリとして oauth2(http://pypi.python.org/pypi/oauth2/) を利用したサンプルプログラムです。
下のコードを保存して (oauth_consumer.py とします)、YOUR_CONSUMER_KEY, YOUR_CONSUMER_SECRET となっている部分を自分の consumer_key, consumer_secret で置き換えます。
$ python oauth_consumer.py
... で起動してから http://localhost:5000 に Web ブラウザでアクセスして下さい。
@kurozumi
kurozumi / multiprocess.py
Created May 27, 2016 16:35
【Python】Seleniumを使ってマルチプロセス(並列プロセス)でFirefoxを起動する方法
from selenium import webdriver
from multiprocessing import Pool
def browser(url):
browser = webdriver.Firefox()
browser.get(url)
browser.close()
p = Pool(10)
p.map(browser, [
@numberwhun
numberwhun / 22 Hacking Sites To Practice Your Hacking Skills
Created July 14, 2016 00:36
22 Hacking Sites To Practice Your Hacking Skills
Taken from: https://hackerlists.com/hacking-sites/
22 Hacking Sites, CTFs and Wargames To Practice Your Hacking Skills
InfoSec skills are in such high demand right now. As the world continues to turn everything into an app and connect even the most basic devices to the internet, the demand is only going to grow, so it’s no surprise everyone wants to learn hacking these days.
However, almost every day I come across a forum post where someone is asking where they should begin to learn hacking or how to practice hacking. I’ve compiled this list of some of the best hacking sites to hopefully be a valuable resource for those wondering how they can build and practice their hacking skill set. I hope you find this list helpful, and if you know of any other quality hacking sites, please let me know in the comments, so I can add them to the list.
1. CTF365 https://ctf365.com/
@uchcode
uchcode / Create-standalone-Mac-OS-X-applications-with-Python.md
Last active February 8, 2023 05:05
PythonでスタンドアロンのMac OS Xアプリケーションを作成する

PythonでスタンドアロンのMac OS Xアプリケーションを作成する

Pythonのプログラムを配布可能なアプリケーションを作成する方法について扱います。

Pythonプログラムの実行方式

コンピュータが理解できるのは突き詰めると、0と1だけです。そのため、プログラムを実行するには「プログラミング言語で書かれたテキストのプログラム」を0と1に変換する必要があります。そのやり方には2つあり、ひとつはコンパイラを使うもので、もうひとつはインタプリタを使うものです。

以下に両者の違いについて記載します。

@sifue
sifue / 無料で読めるポール・グレアムの「ハッカーと画家」+αの日本語訳のみのまとめ.md
Last active May 19, 2024 00:26
無料で読めるポール・グレアムの「ハッカーと画家」+αの日本語訳のみのまとめ

がんばって curl コマンドだけで Google Drive にファイル上げるメモ

基本は、PythonでGoogle Drive API v3を利用して画像のアップロード の準備のトコとGoogle APIのAccess Tokenをお手軽に取得する、の合せ技

やること6. でリフレッシュトークンが貰えれば、あとは 8. を繰替えすだけで良い。(1.7. は一回だけやればいいハズ)

ただ、 リフレッシュトークンがあると、Google Drive に対してやりたいほうだいになるので、リフレッシュトークンをクライアントに配るようは運用は考えづらい。善意で成り立っているなら、専用のアカウント作って運用、みたいなのはあるのか?

やるならファイルのアップロードを受けてるような中継用のサーバアプリを用意して、こいつで送信する、とか?(それならコマンドなんか使わずに、いろんな言語でSDKが出てるのでそれを使うから、やっぱ緊急用か、これは。)

@ommadawn46
ommadawn46 / javascript_class.md
Last active December 8, 2020 01:16
Javascriptのclass構文について調べたこと

Javascriptのclass構文について

class構文

https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Classes

  • ECMAScript 6で追加された
  • 昔はprototypeを利用してクラス的な振る舞いをするオブジェクトを作成することが多かったが、class構文を使えば簡単にクラスを扱うことができる
    class Polygon {
      constructor(height, width) {
        this.height = height;
@sshymko
sshymko / chrome_update_block.sh
Last active October 27, 2020 13:28
Google Chrome auto-update block for Mac OS
#!/bin/sh
sudo tee -a /etc/hosts << EOF
# Block Google Chrome auto-update
0.0.0.0 tools.google.com
EOF
@mpppk
mpppk / clean_architecture.md
Last active May 30, 2024 10:56
クリーンアーキテクチャ完全に理解した

2020/5/31追記: 自分用のメモに書いていたつもりだったのですが、たくさんのスターを頂けてとても嬉しいです。
と同時に、書きかけで中途半端な状態のドキュメントをご覧いただくことになっており、大変心苦しく思っています。

このドキュメントを完成させるために、今後以下のような更新を予定しています。

  • TODO部分を埋める
  • 書籍を基にした理論・原則パートと、実装例パートを分割
    • 現在は4層のレイヤそれぞれごとに原則の確認→実装時の課題リスト→実装例という構成ですが、同じリポジトリへの言及箇所がバラバラになってしまう問題がありました。更新後は、実装時の課題リストを全て洗い出した後にまとめて実装を確認する構成とする予定です。

2021/1/22追記:

@jesster2k10
jesster2k10 / README.md
Last active May 6, 2024 18:16
Rails API Social Login

Rails API-Only Social Login

This is another piece of code I've extrapolated from a Ruby on Rails project I'm currently working on. The code implmenets social login with a RoR API-based application, targeted at API clients.

The setup does not involve any browser-redirects or sessions as you would have to use working with Omniauth. Instead, what it does is takes an access_token generated on client-side SDKs, retireves user info from the access token and creates a new user and Identity in the database.

This setup works with native applications as described in the Google iOS Sign In Docs (see Authenticating with a backend server)