Skip to content

Instantly share code, notes, and snippets.

Misaka 0x4e21 misaka4e21

Block or report user

Report or block misaka4e21

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.js
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);
@misaka4e21
misaka4e21 / gnuk-1.1.3.diff
Created Aug 29, 2017
stm32f103c8t6 gnuk backup.
View gnuk-1.1.3.diff
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
View keybase.md

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 / dns-force-ipv6.py
Created Jul 20, 2015
A DNS server returns only IPv6 address when AAAA record is available.
View dns-force-ipv6.py
#!/usr/bin/env python
# Copyright (C) R.O.C.2015 Misaka Network <misaka@openmailbox.org>
# 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
View misaka-publickey.asc
-----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 / TopWindow.qml
Last active Oct 27, 2016
A simple QML-layouting in metro style
View TopWindow.qml
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 / aoscey
Created May 13, 2014
安同的aoscey,小图不准确,求重画。
View 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 / bopomofo-pu.schema.yaml
Created Jul 24, 2013
RIME輸入法圃氏注音排列設定檔案(錯誤百出的除錯第零版)
View bopomofo-pu.schema.yaml
# Rime schema
# encoding: utf-8
schema:
schema_id: bopomofo-pu
name: 注音(圃式排列)
version: "0.0"
author:
- 佛振 <chen.sst@gmail.com>
- 陳立圃
@misaka4e21
misaka4e21 / subway-clutter-design.py
Created Jan 5, 2013
剛發現Python的with語句,很適合寫Clutter
View subway-clutter-design.py
#!/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 / bot.rb
Created Apr 9, 2012
一個用ruby+cinch寫的irc機器人——mew
View bot.rb
#!/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条)。请各位谅解。公安部国内安全保卫大队。"
You can’t perform that action at this time.