Skip to content

Instantly share code, notes, and snippets.

View Na0ki's full-sized avatar
🤔
thinking

ahiru Na0ki

🤔
thinking
View GitHub Profile
@Na0ki
Na0ki / eject.py
Created June 1, 2014 13:08
multi platform eject command using python
# coding: UTF-8
import platform
import os
import ctypes
# windows
if platform.system() == 'Windows':
# need 'u' before "", if you are using UTF-8. if not you don't need to put it.
ctypes.windll.WINMM.mciSendStringW(u"set cdaudio door open", None, 0, None)
#ctypes.windll.WINMM.mciSendStringW(u"set cdaudio door closed", None, 0, None)
#!/usr/bin/env python
#coding: utf-8
import RPi.GPIO as GPIO
import os
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN)
@Na0ki
Na0ki / checkVer.m
Last active August 29, 2015 14:12
アプリのバージョンを比較するやつ(Objective-C)
static const int VER_NUM = 3;
- (void)viewDidLoad
{
[super viewDidLoad];
// アプリバージョンを取得
// NSString *currentVer = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSString *currentVer = @"0.0.3" //example
// 最新のバージョン
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <net/if.h>
@implementation WifiUtils
- (BOOL) checkIsWifi {
struct ifaddrs *addresses;
struct ifaddrs *cursor;
BOOL available = NO;
# -*- coding: utf-8 -*-
Plugin.create(:ahiru_yakuna) do
DEFINED_TIME = Time.new.freeze
criminals = Set.new
あひる焼き = %w(burned\ duck)
filter_filter_stream_track do |watching|
@Na0ki
Na0ki / TaskViewGestureToolkitLog.txt
Created September 26, 2016 10:33
置いた場所が悪かった。(管理者で実行すれば当然ながらこれは発生しない)
Just-In-Time (JIT) デバッグを呼び出すための詳細については、
ダイアログ ボックスではなく、このメッセージの最後を参照してください。
************** 例外テキスト **************
System.UnauthorizedAccessException: パス 'C:\Program Files (x86)\TaskViewGestureToolkit\log.txt' へのアクセスが拒否されました。
場所 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
場所 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
場所 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
場所 System.IO.FileStream..ctor(String path, FileMode mode)
場所 TaskViewGestureToolkit.Log.Logger.writeToLogfile()
@Throws(ClassCastException::class, InvalidClassException::class)
inline fun <reified T : Any> get(id: Int): T {
return get(sApp.getString(id))
}
@Throws(ClassCastException::class, InvalidClassException::class)
inline fun <reified T : Any> get(key: String): T {
return when (T::class) {
String::class -> sPrefs.getString(key, "") as T? ?: "" as T
Set::class -> sPrefs.getStringSet(key, emptySet()) as T? ?: emptySet<String>() as T
app.post('/', async (req, res) => {
const html = req.body.html;
if (!html) {
await res.status(400);
return;
}
try {
await page.goto(
`data:text/html,${html}`, {
timeout: pageTimeoutMsec,
@Na0ki
Na0ki / scraping.py
Last active August 22, 2018 14:13
とある小説サイトのページをスクレイピングして新着があればslackに通知するやつ
import datetime
import json
import requests
from bs4 import BeautifulSoup
TARGET = 'SCRAPING_TARGET_URL'
HOOK = 'SLACK_WEB_HOOK_URL'
@Na0ki
Na0ki / frozen_toshi_a.rb
Last active November 6, 2018 11:17
すこ〜しも寒くないわ〜
# -*- coding: utf-8 -*-
require 'httpclient'
Plugin.create(:frozen_toshi_a) do
filter_is_toshi_a_frozen? do
[Plugin::Toshia.frozen?]
end
end
class Plugin::Toshia