Skip to content

Instantly share code, notes, and snippets.

View ryu22e's full-sized avatar

Ryuji Tsutsui ryu22e

View GitHub Profile
@ryu22e
ryu22e / main.py
Last active November 5, 2021 02:27
Retry POST requests with Python Requests
#!/usr/bin/env python
from requests import Session
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util import Retry
def main():
retries = Retry(
total=5,
backoff_factor=1,
@ryu22e
ryu22e / README.md
Created March 12, 2021 11:45
automove_mousecursor.py

Setup

$ pip install PyAutoGUI==0.9.52
@ryu22e
ryu22e / PlayerTest.java
Created November 8, 2011 08:23
入れ子構造になっているJUnit4テストの書き方
package org.ryu22e;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
/**
* @author ryu22e
* @see <a href="http://d.hatena.ne.jp/shuji_w6e/20111205/1323098690">http://d.hatena.ne.jp/shuji_w6e/20111205/1323098690</a>
*/
@ryu22e
ryu22e / PoC.md
Last active June 3, 2020 13:57
【memo】PoC for CVE-2020-13254(Potential data leakage via malformed memcached keys)
@ryu22e
ryu22e / Bookmarklet.js
Created May 17, 2020 07:42
[Bookmarklet]Copy as Markdown link
javascript:!function(a){var b=document.createElement("textarea"),c=document.getSelection();b.textContent=a,document.body.appendChild(b),c.removeAllRanges(),b.select(),document.execCommand("copy"),c.removeAllRanges(),document.body.removeChild(b)}(`[${document.title}](${location.href})`);
@ryu22e
ryu22e / memo.sh
Created April 22, 2020 08:28
GItHub API memop
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-H "Content-Type: application/json" \
https://api.github.com/repos/ryu22e/django_demo/deployments/${DEPLOYMENT_ID}/statuses \
--data '{"state": "success"}'
@ryu22e
ryu22e / bad-models.py
Last active September 6, 2019 01:15
SQLアンチパターン for Django 2章 ナイーブツリー(素朴な木)
"""悪い例"""
from django.conf import settings
from django.db import models
class Bug(models.Model):
pass
class Comment(models.Model):
@ryu22e
ryu22e / bad-models.py
Last active September 6, 2019 01:14
SQLアンチパターン for Django 1章 ジェイウォーク(信号無視)
"""悪い例"""
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=1000)
account_id = models.CharField(max_length=100) # カンマ区切りでIDを入れる(例: '1,2,3')
@ryu22e
ryu22e / models.py
Last active August 23, 2019 04:03
Djangoの脆弱性CVE-2019-14232・CVE-2019-14233・CVE-2019-14234・CVE-2019-14235について解説(1)
# example/models.py
from django.db import models
from django.contrib.postgres.fields import JSONField
class Example(models.Model):
value = JSONField(verbose_name="値")
enabled = models.BooleanField(verbose_name="有効")
@ryu22e
ryu22e / models.py
Created July 24, 2019 14:33
[WIP]Django path関数を使ったURL定義のやり方(1)
from django.db import models
class Book(models.Model):
title = models.CharField(max_length=50, verbose_name="タイトル")