Skip to content

Instantly share code, notes, and snippets.

@aont
aont / imgs.js
Created February 13, 2014 05:22
imgs
var imgs = document.getElementsByTagName("img");
var w = window.open("");
var i;
for ( i=0; i<imgs.length; i++) {
var src = imgs[i].src;
if(src.indexOf("AAAAA")!=-1) {
var a = w.document.createElement("a");
@aont
aont / ipaddress_imap.rb
Created March 9, 2014 10:32
PR-400のIPアドレス変化通知メールをリアルタイム検知
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'net/imap'
require 'kconv'
Net::IMAP::debug = true
imap = Net::IMAP.new('imap.gmail.com', 993, true)
imap.login('hoge@gmail.com', 'pass')
@aont
aont / ddns.rb
Last active August 29, 2015 13:57
PR-400NE,KIでWANアドレス監視
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'nokogiri'
require 'net/http'
require 'net/https'
$router_user = "hoge"
@aont
aont / binsel
Created March 19, 2014 07:45
binary selector
#!/bin/sh
platform="$(uname -s).$(uname -p)"
if [ -n "$1" ]; then
prog="$1"
shift
if [ -e "$prog.$platform" ]; then
@aont
aont / org.macports.sane-backends.plist
Last active August 29, 2015 13:57
launchd plist for saned
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<!--
Ref: https://trac.macports.org/attachment/ticket/27791/Portfile.diff
-->
<plist version='1.0'>
<dict>
<key>Label</key>
<string>org.macports.sane-backends</string>
@aont
aont / popcnt.cpp
Last active August 29, 2015 14:04
ちまたでpopcntというものが話題になっていたので、ソフトウェア実装してみる。
// #define __POPCNT__
// #include <x86intrin.h>
#include <cstdio>
#include <cstdlib>
#include <stdint.h>
#include <inttypes.h>
#include <vector>
#include <sys/time.h>
@aont
aont / Makefile
Last active August 29, 2015 14:04
reduction by binary tree
CXXFLAGS += -O3 -funroll-loops -march=native
.PHONY: all
all: forward backward tunroll munroll normal
forward: main.cpp
$(CXX) -DFORWARD -DTREDUCTION $(CXXFLAGS) main.cpp -o forward
backward: main.cpp
$(CXX) -DTREDUCTION $(CXXFLAGS) main.cpp -o backward
@aont
aont / main.cu
Created August 8, 2014 13:03
Generating kernel from function object is helpful?
#include <thrust/device_vector.h>
#include <thrust/host_vector.h>
struct init_functor
{
float* data_device;
init_functor(float* const data_device)
: data_device(data_device)
@aont
aont / main.cpp
Last active August 29, 2015 14:05
sprintf returning std::string
#include <cstdio>
#include <cstdarg>
#include <string>
#include <exception>
// #include <cstdlib>
// #include <vector>
// #include <iostream>
@aont
aont / main.cpp
Created August 20, 2014 05:42
log2
#include <cstdio>
#include <cstdlib>
// int main()
// {
// const size_t size = sizeof(char)*8;
// for(size_t l=0; l<8; ++l) {
// const size_t i_begin = 1<<l;
// const size_t i_end = 1<<(l+1);
// for(size_t i=i_begin; i<i_end; ++i) {