Skip to content

Instantly share code, notes, and snippets.

@2GMon
2GMon / firefox_tab_manipulater.json
Created May 28, 2018 02:00
Firefoxのタブ切り替え用karabiner-element設定
{
"title": "Firefox Tab Manipulater",
"rules": [
{
"description": "Firefox Tab Manipulation",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "t"
@2GMon
2GMon / recpt1_fix_bs_egp.patch
Last active October 26, 2019 07:56
PT3環境でmirakurun と http://www13.plala.or.jp/sat/recdvb/recdvb-1.3.1.tgz の組み合わせでEPGが取得できない問題に対する修正
--- recpt1.c.orig 2019-09-22 18:18:28.164084939 +0900
+++ recpt1.c 2019-09-22 18:23:46.901127087 +0900
@@ -51,23 +51,23 @@
char *channel;
int tsid;
} preset_ch[NUM_PRESET_CH] = {
- { 101, "bs15", 0x40f1 }, { 103, "bs03", 0x4031 },
- { 141, "bs13", 0x40d0 }, { 151, "bs01", 0x4010 },
- { 161, "bs01", 0x4011 }, { 171, "bs01", 0x4012 },
- { 181, "bs13", 0x40d1 }, { 191, "bs03", 0x4030 },
@2GMon
2GMon / vimpr.diff
Created March 16, 2016 06:27
twittperator work around
diff --git a/twittperator.js b/twittperator.js
index 62d5b55..b886a39 100644
--- a/twittperator.js
+++ b/twittperator.js
@@ -2081,6 +2081,30 @@ let INFO = xml`
});
}, // }}}
sourceScriptFile: function(file) { // {{{
+ const Script = Class("Script", {
+ init: function (file) {
@2GMon
2GMon / error.txt
Last active August 29, 2015 14:00
RaspberryPiにchef-rbenvでruby 2.1.1をインストールしようとしたときに出たエラー
Recipe: rbenv::system
* rbenv_ruby[2.1.1] (system) action installRecipe: <Dynamically Defined Resource>
* rbenv_script[rbenv install 2.1.1 (system)] action run * script[rbenv install 2.1.1 (system)] action run
================================================================================
Error executing action `run` on resource 'script[rbenv install 2.1.1 (system)]'
================================================================================
Mixlib::ShellOut::CommandTimeout
--------------------------------
@2GMon
2GMon / perceptron.rb
Last active December 17, 2015 07:49
# パーセプトロン(2クラスかつ線形分類可能なデータのみ)
# coding: utf-8
require "pp"
# dimention次元の特徴に対する拡張重みベクトルを
# 乱数によって初期化
def initialize_weight(dimention)
weight = Array.new(dimention + 1)
(dimention + 1).times do |i|
weight[i] = rand()
@2GMon
2GMon / dailycoding39.hs
Created August 30, 2012 04:13
Project Euler : Problem 39
-- Project Euler : Problem 39
import Data.List
rectTriangle :: Int -> [Int]
rectTriangle n = [a + b + c | a <- [1..(n - 2)], b <- [1..(a - 1)],
c <- [1..(b-1)], a^2 == b^2 + c^2,
a + b + c <= n]
main = print $ snd $ maximum $ map (\x -> (length x, head x)) $ group $
@2GMon
2GMon / dailycoding38.hs
Created August 29, 2012 02:03
Project Euler : Problem 38
-- Project Euler : Problem 38
import Data.List
isPandigital :: Maybe String -> Bool
isPandigital Nothing = False
isPandigital (Just x) = all (`elem` x) ['1'..'9']
catProduct :: Int -> Maybe String
catProduct x = find (\x -> (length x) == 9) $ map (product x) [2..9]
@2GMon
2GMon / dailycoding37.hs
Created August 28, 2012 06:06
Project Euler : Problem 37
-- Project Euler : Problem 37
import Data.List
import Data.Char
-- [a]と[b]の全ての組み合わせをfで計算するzipWithみたいなもの
-- 例: zipWith' (*) [1,2,4,8] [1,3]
-- >> [1,3,2,6,4,12,8,24]
zipWith' :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith' _ _ [] = []
@2GMon
2GMon / dailycoding36.hs
Created August 27, 2012 03:01
Project Euler : Problem 36
-- Project Euler : Problem 36
binary :: Integer -> String
binary 0 = "0"
binary 1 = "1"
binary n = (binary $ fst div) ++ (show $ snd div)
where div = n `divMod` 2
main = print $ sum [a | a <- [1..999999],
(show a) == (reverse $ show a),
@2GMon
2GMon / split_cpp.cpp
Created August 23, 2012 03:05
boost::algorithmで文字列split
#include <iostream>
#include <string>
#include <list>
#include <boost/tokenizer.hpp>
#include <boost/algorithm/string.hpp>
int main(int argc, char const* argv[])
{
std::string str = "piyo,huga,hoge";