Skip to content

Instantly share code, notes, and snippets.

@regen100
regen100 / service.py
Created April 16, 2014 16:00
Python Windows Service
import win32serviceutil
class SampleService(win32serviceutil.ServiceFramework):
_svc_name_ = 'SampleService'
_svc_display_name_ = 'Sample Service'
_svc_description_ = 'This is Sample service.'
def SvcDoRun(self):
self.run = True
while self.run:
@regen100
regen100 / sol.py
Created May 23, 2014 15:30
Suspend on LAN Service
import win32serviceutil
import servicemanager
import ctypes
import socket
import select
import netifaces
import time
from contextlib import closing
def suspend(hibernate=False):
@regen100
regen100 / discas.py
Created August 5, 2014 22:49
DISCAS scraping
# -*- coding: utf-8 -*-
import lxml.html
URLFORMAT = 'http://www.discas.net/netdvd/cd/goodsDetail.do?titleID=%010d'
# XPathをコンパイルして再利用する
find_title = lxml.etree.XPath(
'string(//head/meta[@property="og:title"]/@content)')
is_available = lxml.etree.XPath(
@regen100
regen100 / vcvarsall.bat
Last active August 29, 2015 14:06
vcvarsall.bat for VC++ 9.0 (2008)
@echo off
if "%1" == "" goto x86
if not "%2" == "" goto usage
if /i %1 == x86 goto x86
if /i %1 == amd64 goto amd64
if /i %1 == x64 goto amd64
if /i %1 == ia64 goto ia64
if /i %1 == x86_amd64 goto x86_amd64
if /i %1 == x86_ia64 goto x86_ia64
@regen100
regen100 / install-numba.sh
Created April 5, 2015 17:15
Install numbda on Ubuntu 14.04 and Python 2.7
sudo apt-get install zlib1g-dev libedit-dev llvm-3.5-dev
LLVM_CONFIG=/usr/bin/llvm-config-3.5 sudo -E pip install llvmlite
sudo pip install enum34 funcsigs numbda
@regen100
regen100 / serial.cpp
Created December 10, 2016 14:07
Get Raspberry Pi serial number
#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdint>
#include <iomanip>
#include <experimental/optional>
/*
* Get Raspberry Pi serial number
*/