Skip to content

Instantly share code, notes, and snippets.

View karno's full-sized avatar
🤔

Karno karno

🤔
View GitHub Profile
@karno
karno / ssrl.py
Created January 7, 2019 07:07
fetch menus from sushiro
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SSRL: SuShiRo menu List acquisitor script.
import datetime
import json
import re
import sys
@karno
karno / main.rs
Last active November 6, 2018 16:44
bmp2gray
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::io::{BufReader, BufWriter, Read, Result, SeekFrom, Write};
use std::mem::transmute;
trait ToInt<T> {
fn to_int(&self) -> T;
}
@karno
karno / TaskFactoryDistrict.cs
Created December 3, 2015 13:34
TaskScheduler with priorities and limited concurrency.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Cadena.Engine._Internals
{
public sealed class TaskFactoryDistrict
{
#!/usr/bin/env python
# -*- coding: utf-8 -*-
config = {
"consumer": {
"key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
},
"token": {
"key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
@karno
karno / main.rs
Created July 20, 2017 14:23
failing compile
#[derive(Debug)]
struct Point {
x: f64,
y: f64,
}
impl std::ops::Add for Point {
type Output = Point;
fn add(self, rhs: Point) -> Point {
Point::new(self.x + rhs.x, self.y + rhs.y)
#!/usr/local/bin/python3
import urllib.request
urlfmt = "http://www.tbs.co.jp/anime/urara/special/img/stamp_{0:02d}/{1:02d}.png"
fnfmt = "{0:02d}_{1:02d}.png"
for di in range(1, 13):
for fi in range(1, 100):
try:
url = urlfmt.format(di, fi)
@karno
karno / Surveyor.java
Created October 6, 2014 18:52
はるアイコン鯖の surveyor プラグインのコード
package com.troidworks.bukkit.surveyor;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Text;
namespace Cadena.Meteor
{
public static class MeteorJson
{
using System;
namespace Cadena.Meteor
{
internal static class MeteorJsonHelper
{
public static unsafe string UnsafeUnescape(string jsonString, int decodedLength)
{
var len = jsonString.Length;
var buf = new char[decodedLength];
using System.Windows;
using System.Windows.Interactivity;
namespace Karno.Xac.Sample
{
public sealed class DragAcceptBehavior : Behavior<FrameworkElement>
{
public DragAcceptDescription Description
{
get { return (DragAcceptDescription)GetValue(DescriptionProperty); }