Skip to content

Instantly share code, notes, and snippets.

@JaHIY
JaHIY / bilibiliplayswf.user.js
Created July 19, 2012 09:32
Greasemonky script:Bilibili test-version flash player
// ==UserScript==
// @name Bilibili test-version flash player
// @description this script can force browser use test-version flash player
// @author jahiy
// @version 0.3.1
// @match https://secure.bilibili.tv/secure,*
// @match http://www.bilibili.tv/video/*
// ==/UserScript==
function main() {
@JaHIY
JaHIY / toArray.js
Created August 4, 2012 09:37
JavaScript:multidimensional arrays to one dimensional array
/* Recursion Method */
function toArray(array) {
var result=[];
function toarray(array) {
for (var l=array.length,i=0;i<l;i++) {
if (Array.isArray(array[i])) {
toarray(array[i]);
} else {
@JaHIY
JaHIY / unzip.py
Created August 28, 2012 16:28
python: unzip
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import os
import codecs
import zipfile
import textwrap
def print_usage(myname):
USAGE = textwrap.dedent("""
@JaHIY
JaHIY / fullfeed.py
Created September 5, 2012 08:33
python:hexieshe.com fullfeed
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib.request
import html.parser
import xml.etree.ElementTree
import queue
import threading
import functools
import os
@JaHIY
JaHIY / htmlparser.py
Created September 10, 2012 15:13
python:htmlparser
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import html.parser
class ContentParser(html.parser.HTMLParser):
def __init__(self, begin_tag, stop_tag):
html.parser.HTMLParser.__init__(self)
tag_temple = ('type', 'name', 'attrs', 'contains_me')
self.begin_tag = dict(zip(tag_temple, begin_tag))
+
#
###
#####
######
; #####;
+##.#####
+##########
#############;
###############+
@JaHIY
JaHIY / ip-address.c
Created September 16, 2012 08:33
C:if it is a valid ipv4 address
#include <stdio.h>
#include <string.h>
int is_valid_ipv4(const char *str) {
int tmp = 0, dot = 0, digit = 0, i = 0;
size_t len = strlen(str) + 1;
while (i < len) {
//printf("%s, %d\n", str, tmp);
if (*str < 48 || *str > 57) {
if (*str == '.' || *str == '\0') {
@JaHIY
JaHIY / bra.c
Last active October 11, 2015 04:37
C:calculate your cup size
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* * * * * * * * * * * * * * * * * * * * *
*
@JaHIY
JaHIY / cup.c
Created October 1, 2012 15:35
C:calculate bust size by cup size
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* Usage: ./cup your_cup_size your_underbust_size
*
* for example:
* ./cup B 75
@JaHIY
JaHIY / components.patch
Last active April 9, 2017 20:46
patch: for Echofon(Firefox Add-on) 2.5.2
diff -uNr /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/components/nsEchofon.js /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/[email protected]/components/nsEchofon.js
--- /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/echofon_for_twitter-2.5.2-fx/components/nsEchofon.js 2012-09-19 06:55:02.000000000 +0800
+++ /home/jahiy/Documents/echofon_for_twitter-2.5.2-fx/[email protected]/components/nsEchofon.js 2013-01-27 16:56:49.000000000 +0800
@@ -25,7 +25,7 @@
Components.utils.import("resource://echofon/TwitterClient.jsm");
Components.utils.import("resource://echofon/EchofonHttpRequest.jsm");
Components.utils.import("resource://echofon/Timeline.jsm");
- Components.utils.import("resource://echofon/EchofonGA.jsm");
+ //Components.utils.import("resource://echofon/EchofonGA.jsm");