Skip to content

Instantly share code, notes, and snippets.

View Tosainu's full-sized avatar
🌸
ヾ( ╹◡╹ 🌸 )ノ"

Kenta Sato Tosainu

🌸
ヾ( ╹◡╹ 🌸 )ノ"
View GitHub Profile
@Tosainu
Tosainu / live
Created March 10, 2014 05:33
ffmpegでLive配信
#!/bin/sh
RTMP_URL=''
STREAM_KEY=''
VIDEO_SOURCE='/dev/video0'
VIDEO_INPUT_SIZE='1280x720'
VIDEO_OUTPUT_SIZE='640x360'
VIDEO_FRAMERATE=10
VIDEO_BITRATE=288
VIDEO_BUFFER=500
@Tosainu
Tosainu / stap.cc
Last active August 29, 2015 14:02
例のアレ
#include <iostream>
#include <random>
auto main() -> int {
std::mt19937 rd{std::random_device()()};
std::uniform_int_distribution<const char> stuff('A', 'Z');
unsigned long long int cnt;
std::string cell;
@Tosainu
Tosainu / niconico.js
Created August 14, 2014 04:27
ニコ動にログインしてデフォルトのマイリスト(とりあえずマイリスト)を取得
var request = require('request').defaults({jar: true});
var options_login = {
url: 'https://secure.nicovideo.jp/secure/login?site=niconico',
form: {
mail_tel: 'YOUR MAIL ADDR',
password: 'YOUR PASSWORD'
}
};
@Tosainu
Tosainu / fizzbuzz.cc
Last active August 29, 2015 14:10
g++ -std=c++11 -Wall -Wextra `pkg-config ruby-2.1 --cflags --libs` fizzbuzz.cc
#include <iostream>
#include <ruby.h>
auto main() -> int {
ruby_init();
ruby_init_loadpath();
int status;
rb_eval_string_protect(R"(
1.upto(100) do |x|
@Tosainu
Tosainu / Makefile
Last active August 29, 2015 14:11
twitppを使ったC++11製update_name. Tosainu/twitppとdropbox/json11, 最新のBoostと(gcc|clang)が要ります.
update_name: update_name.cc json11/json11.cpp
clang++ -Wall -Wextra -std=c++14 -ltwitpp $^ -o $@
@Tosainu
Tosainu / main.cc
Last active August 29, 2015 14:13
QtでJson
#include <QCoreApplication>
#include <QJsonDocument>
#include <QJsonObject>
#include <QDebug>
int main(int argc, char *argv[]) {
QCoreApplication a(argc, argv);
auto json = QJsonDocument::fromJson(QByteArray(R"(
{
#include <QCoreApplication>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
#include <QString>
#include <QDebug>
class JsonValue : public QJsonValue {
public:
JsonValue(QJsonValue&& value) : QJsonValue(value) {}
#if !defined HELPER_HPP
#define HELPER_HPP
#include <codecvt>
#include <locale>
#include <string>
namespace helper {
std::string to_string(const std::wstring& src) {
#include <iostream>
#include <boost/asio.hpp>
auto main(int argc, char** argv) -> int {
if (argc != 3) {
std::cerr << "Usage: " << argv[0] << " <ip> <port>" << std::endl;
return 1;
}
boost::asio::io_service io;
@Tosainu
Tosainu / Makefile
Last active December 22, 2015 16:54
# nyan!
TARGET = out
SRC = http_client.cc
# compiler configs
CFLAGS = /nologo /c /EHsc /GL /GS /Gy /MD /MP /O2 /W3 /Zi /sdl /Fd:$(TARGET).pdb
INCPATH = /I"$(BOOST_INCLUDEDIR)" /I"$(OPENSSL_INCLUDEDIR)"
DEFINES = /D_WIN32_WINNT=0x0601