Skip to content

Instantly share code, notes, and snippets.

@swdyh
swdyh / quiet_internet_client.dart
Created November 16, 2023 07:24
quiet intternet dart client
import 'dart:convert' as convert;
import 'dart:io' as io;
Future<void> main() async {
final apiKey = io.Platform.environment['QUIET_INTERNET_API_KEY']!;
final client = QuietInternetClient(apiKey: apiKey);
final posts = await client.getPosts(perPage: 1, visibility: 'ANYONE');
for (final post in posts) {
final postDetail = await client.getPost(post.slug);
print([
require 'time'
# http://doc.ruby-lang.org/ja/2.0.0/method/Time/i/iso8601.html
t = Time.now
p t # 2013-05-14 18:42:37 +0900
p t.iso8601 # "2013-05-14T18:42:37+09:00"
p t.iso8601(3) # "2013-05-14T18:42:37.192+09:00"
p t.iso8601(6) # "2013-05-14T18:42:37.192681+09:00"
p t.iso8601(10) # "2013-05-14T18:42:37.1926810000+09:00"
require 'sinatra'
get '/' do
<<-EOS
<html>
<head>
<script src="nosniff.js" /></script>
<link rel="stylesheet" href="nosniff.css" />
</head>
<body>nosniff test</body>
#!/usr/bin/env ruby
require 'cgi'
require 'json'
require 'open-uri'
require 'pathname'
def get url
p ['get', url]
r = OpenURI.open_uri(url).read
#!/usr/bin/env ruby
require 'digest/md5'
require 'optparse'
require 'stringio'
module S3Etag
def calc opt = {}
threshold = opt[:threshold] || 16 * 1024 * 1024
#compdef mad
_arguments \
'(-U --update-self)'{-U,--update-self}'[update mad(1) itself]' \
'(-u --update)'{-u,--update}'[update remote mad-pages]' \
'(-v --version)'{-v,--version}'[output mad version]' \
'(-h --help)'{-h,--help}'[output this help information]' \
'(-l --list)'{-l,--list}'[list mad-pages]' \
'-[read from stdin]' \
'*:: :->' && return 0
var util = require('util')
var events = require('events')
var express = require('express')
var redis = require('redis')
var app = express.createServer()
var notifyEmitter = new events.EventEmitter()
var redisClientSubscriber = redis.createClient()
redisClientSubscriber.on('message', function(ch, d) {
util.log(JSON.stringify(['redisSubscriber', ch, d]))
@swdyh
swdyh / file1.txt
Created March 24, 2012 10:33
the description for this gist
String file contents
test test