- GitHub Staff
- https://bento.me/kyanny
- @kyanny
- in/kyanny
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# https://docs.djangoproject.com/en/3.1/topics/settings/#calling-django-setup-is-required-for-standalone-django-usage | |
import django | |
from django.conf import settings | |
# https://blog.amedama.jp/entry/sqlite3-in-memory-issue | |
import tempfile | |
tfile = tempfile.NamedTemporaryFile() | |
import sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import connections,connection,reset_queries | |
from django.conf import settings | |
settings.DEBUG = True | |
def query_count(reset=True): | |
total = sum(len(c.queries) for c in connections.all()) | |
if reset: | |
reset_queries() | |
return total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from django.test import SimpleTestCase | |
from django.conf import settings | |
settings.configure() | |
class InHTMLTestCase(SimpleTestCase): | |
databases = [] | |
def test_ok(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws-logout() { | |
for env in $(awk 'BEGIN{for(v in ENVIRON) print v}' | grep ^AWS) | |
do | |
echo "unset $env" | |
unset $env | |
done | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
profile = "default" | |
region = "ap-northeast-1" | |
} | |
# 1 | |
resource "aws_instance" "instance1" { | |
ami = "ami-0a1c2ec61571737db" | |
instance_type = "t2.micro" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func pp(a []uint64, oldcap int) { | |
if cap(a) != oldcap { | |
var ntimes float64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://getpocket.com/developer/docs/authentication | |
require 'net/http' | |
require 'uri' | |
def usage | |
puts <<USAGE | |
Usage: | |
$ ruby #{$0} <consumer_key> | |
USAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workflow "Post labeled issue to Slack" { | |
resolves = ["GitHub Action for Slack"] | |
on = "issues" | |
} | |
action "Filters for GitHub Actions-1" { | |
uses = "actions/bin/filter@0dbb077f64d0ec1068a644d25c71b1db66148a24" | |
args = "action labeled" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'openssl' | |
require 'uri' | |
require 'json' | |
begin | |
http = Net::HTTP.new(ENV.fetch('MASTODON_HOST'), 443) | |
http.use_ssl = true | |
http.verify_mode = OpenSSL::SSL::VERIFY_PEER |