Skip to content

Instantly share code, notes, and snippets.

@boronology
boronology / training.py
Last active September 14, 2016 13:43
言語処理100本ノック http://www.cl.ecei.tohoku.ac.jp/nlp100/
#00.文字列の逆順
s = ""
for c in "stressed":
s += c
print(s)
#01.「パタトクカシーー」
f = "パタトクカシーー"
s = ""
l = [1,3,5,7]
@boronology
boronology / force_delete.rb
Last active June 30, 2016 13:10
mikutter用プラグイン。「失った信用」とか聞かれたくない人におすすめ。
# -*- coding: utf-8 -*-
# 失う信用のない人向けプラグイン。
# なにも聞かずに対象ツイートを消す。
Plugin.create :force_delete do
command(:force_delete,
name: '何も聞かずに消す',
condition: Plugin::Command[:IsMyMessageAll],
visible: true,
role: :timeline) do |opt|
# this is a config file for system to recognize WQHD monitor
# put this under /etc/X11/xorg.conf.d/
#
# Intel Graphics's HDMI(or Single-Link DVI) can not output 2560x1440 at 60Hz,
# for its limitation of dot clock
# This file provides settings of 2560x1440 by 55Hz using "reduced blanking"
# Thanks, http://blog.keshi.org/hogememo/2013/08/27/linux-hdmi-wqhd-tips
# and http://www.notebookcheck.net/2560x1440-or-2560x1600-via-HDMI.92840.0.html
Section "Device"
@boronology
boronology / flacrip.sh
Last active May 2, 2019 04:19
CDリッピングしてFLACにするやつ(改)。大幅に加筆して他人も使えるようにした。あとPOSIX準拠を心掛けた。
#!/bin/sh
DEVICE=/dev/sr0
OUTPUTBASE=disc
READSPEED=8
OFFSET=0
command_exist(){
if ! type $1 >/dev/null 2>&1; then
echo "$1が存在しません"
exit 1
@boronology
boronology / complex.cpp
Last active December 18, 2015 07:29
ぺんぎんさんからの練習問題 https://twitter.com/penguin2716/status/343915935712825346
#include <iostream>
#include <cmath>
template<typename T> struct complex
{
T real,imag;
complex(T arg1,T arg2) : real(arg1),imag(arg2)
{
}
complex(T arg) : real(arg),imag(0)
@boronology
boronology / cavetube.sh
Created August 3, 2012 05:54
shellscript to help bloadcast using avconv or ffmpeg
#!/bin/sh
#自分の配信URL
OUTPUT_URL=""
#デフォルトのエンコーダはavconv
#ffmpegにしても動作するが、現在DebianやUbuntuはlibavに移行しているので推奨されない
ENCODER=avconv
FRAMERATE=30
@boronology
boronology / gist:3237530
Created August 2, 2012 14:37
one liner FizzBuzz by Python
for i in range(1,101):print "Fizz"*(i%3<1)+"Buzz"*(i%5<1)or i
#include <iostream>
#include <string>
std::string fizzbuzz = "FizzBuzz";
std::string fizz = "Fizz";
std::string buzz = "Buzz";
struct dummyint
{
dummyint(const int i);
@boronology
boronology / fizzbuzz.py
Created July 21, 2012 23:38
fizzbuzz wihtout string literal and division
#! /bin/usr/env python
# -*- coding:utf-8 -*-
import sys
z=sorted(str(sys.builtin_module_names))[-1]
b=sorted(str(sys.builtin_module_names))[231]
f=sorted(sys.copyright)[162]
i=sorted(sys.copyright)[186]
u=sorted(sys.copyright)[294]
#this heavily depends on Python environment