Skip to content

Instantly share code, notes, and snippets.

@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 / 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) {
@aont
aont / main.rb
Last active August 29, 2015 14:05
Get MacAddress - IPAddress table for PR-400NE
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'nokogiri'
require 'net/http'
require 'net/https'
hostname_tbl = {}
hostname_tbl["01:23:45:67:89:Ab"]="hoge.local"
@aont
aont / main.js
Created September 11, 2014 14:14
G Guide -> Dimora
// javascript:
var k=document.querySelector("meta[name='keywords']");if(k){window.open('https://dimora.jp/freeword-search/'+encodeURIComponent(k.content.split(",")[0]));}void(0);
@aont
aont / main.rb
Created September 13, 2014 13:43
lastpass.csv -> csv for each site
#!/usr/bin/ruby
require 'csv'
require 'uri'
CSV.foreach("lastpass.csv") do |row|
url=row[0]
username=row[1]
password=row[2]
name=row[3]
grouping=row[4]
@aont
aont / main.cpp
Created September 28, 2014 08:39
vector of pointer
#include <cstdio>
#include <cstdlib>
#include <typeinfo>
#include <vector>
class deleter_base
{
public:
@aont
aont / main.cpp
Last active August 29, 2015 14:07
Compile Time sqrt(2)
#include <cstdio>
#include <cstdlib>
template<int x>
struct from_int
{
const static double value;
};
template<int x>
const double from_int<x>::value = x;
@aont
aont / autodown.rb
Last active August 29, 2015 14:07
auto shutdown when low battery
#!/usr/bin/ruby
IO.popen("sudo -Hs", "r+") do |sudo|
sudo.puts "echo login_test"
testmes = sudo.gets
if testmes != "login_test\n"
break
end