Skip to content

Instantly share code, notes, and snippets.

View misaka4e21's full-sized avatar

Misaka 0x4e21 misaka4e21

  • Misaka Network
  • Futarino Commune
View GitHub Profile
@misaka4e21
misaka4e21 / bot.rb
Created April 9, 2012 15:22
一個用ruby+cinch寫的irc機器人——mew
#!/usr/bin/env ruby
#coding=utf-8
require 'cinch'
def get_reply(cmd,params,nick)
case cmd
when "tiaoxi"
if params=="" then
return "各位注意:此用户(#{nick})因传播黄色信息依法被消失(依据刑诉法73条)。请各位谅解。公安部国内安全保卫大队。"
@misaka4e21
misaka4e21 / subway-clutter-design.py
Created January 5, 2013 18:34
剛發現Python的with語句,很適合寫Clutter
#!/usr/bin/env python3
#coding=utf-8
import sys
from contextlib import contextmanager
from gi.repository import Clutter
@contextmanager
def mk(class_name,*args,**kwargs):
klass=getattr(Clutter,class_name)
if 'constructor' in kwargs:
@misaka4e21
misaka4e21 / bopomofo-pu.schema.yaml
Created July 24, 2013 05:45
RIME輸入法圃氏注音排列設定檔案(錯誤百出的除錯第零版)
# Rime schema
# encoding: utf-8
schema:
schema_id: bopomofo-pu
name: 注音(圃式排列)
version: "0.0"
author:
- 佛振 <[email protected]>
- 陳立圃
@misaka4e21
misaka4e21 / aoscey
Created May 13, 2014 07:29
安同的aoscey,小图不准确,求重画。
#!/bin/bash
FREEMEM=`free | awk '/^Mem:/{print $4}'`
IE_DISTRO="\033[31mDistribution: \033[37m`lsb_release -i | cut -c17-`\033[36m"
IE_PROCESSOR="\033[31mProcessor: \033[37m`cat /proc/cpuinfo | grep 'model name' | head -n1 | cut -c14-`\033[36m"
IE_ARCH="\033[31mArchitecture: \033[37m`uname -m`\033[36m"
IE_KERNEL="\033[31mKernel: \033[37m`uname -r`\033[36m"
IE_UPTIME="\033[31mUptime: \033[37m`cat /proc/uptime | grep -o '^[0-9]\+'` Minutes\033[36m"
IE_FREERAM="\033[31mFree RAM: \033[37m`expr $FREEMEM / 1024` MiB\033[36m"
@misaka4e21
misaka4e21 / TopWindow.qml
Last active October 27, 2016 08:35
A simple QML-layouting in metro style
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Window 2.0
ApplicationWindow {
visibility: Qt.WindowFullScreen
visible: true
flags:Qt.FramelessWindowHint
color: "#23a"
@misaka4e21
misaka4e21 / misaka-publickey.asc
Created January 11, 2015 07:32
自曝身份。
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2
mQENBFSyJUABCADNfOEYZkkvyAwlxd0LNHCw9ywK9L73WD9RY3++xDDBuZVzQxWR
goY6NFCVRT6Uo4aW/K7zdTLtX68U9046nWGBpqxJzXvlPzczBf6hao17KXDU0XL+
mZYIgL8EJPNYyKyaIG1Pqykh9cWqYrsUP1xOg6UQBUiZJvJWI8KA4cHEggJ5WAxX
7lyvwFViVGKeRbawJ03lImDgGHvmYvsXg/XStzsqkSxp2iAxwsAbnQrxqMFvzHte
OtH6Q2uhHmsk0/0HCqHuzWW/Bmv7Am8B++/uxuVAT+2XDdZJUNsECY4PNvrnogis
3RV6gasEArqpq6T76wWZrK/8BISlLG/mFwqlABEBAAG0Lk1pc2FrYSBmYzAwOjo0
ZTIwLzEyNCA8bWlzYWthQG9wZW5tYWlsYm94Lm9yZz6JATcEEwEIACEFAlSyJUAC
@misaka4e21
misaka4e21 / dns-force-ipv6.py
Created July 20, 2015 16:22
A DNS server returns only IPv6 address when AAAA record is available.
#!/usr/bin/env python
# Copyright (C) R.O.C.2015 Misaka Network <[email protected]>
# License under WTFPL
from dnslib.server import *
from dnslib import *
class TestResolv:
def resolve(self,request,handler):
ipv4=False
if request.q.qtype == QTYPE.A:
ipv4=True
@misaka4e21
misaka4e21 / keybase.md
Created May 19, 2017 08:18
自曝身分(2)

Keybase proof

I hereby claim:

  • I am misaka4e21 on github.
  • I am misaka4e21 (https://keybase.io/misaka4e21) on keybase.
  • I have a public key whose fingerprint is E4B2 DFA3 968B 7A27 8613 2C7B 5A3C 5273 80A0 4200

To claim this, I am signing this object:

@misaka4e21
misaka4e21 / gnuk-1.1.3.diff
Created August 29, 2017 08:02
stm32f103c8t6 gnuk backup.
diff --git a/src/usb_lld.h b/src/usb_lld.h
index 2c7a931..74e2478 100644
--- a/src/usb_lld.h
+++ b/src/usb_lld.h
@@ -1,3 +1,5 @@
+#ifndef __HEHE__
+#define __HEHE__
#define USB_DEVICE_DESCRIPTOR_TYPE 0x01
#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
#define USB_STRING_DESCRIPTOR_TYPE 0x03
@misaka4e21
misaka4e21 / index.js
Created July 9, 2018 04:11
telegram-amsbot
const fs = require('fs')
function getRandomArrayElements(arr, count) {
var shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
while (i-- > min) {
index = Math.floor((i + 1) * Math.random());
temp = shuffled[index];
shuffled[index] = shuffled[i];
shuffled[i] = temp;
}
return shuffled.slice(min);