Skip to content

Instantly share code, notes, and snippets.

@talentwill
talentwill / letters-to-100.py
Created November 7, 2017 02:38 — forked from peterjmag/letters-to-100.py
Find English words whose letter values add up to 100
#!/usr/bin/env python
# encoding: utf-8
"""
letters-to-100.py
"""
import string
letter_values = dict((l, i) for i, l in enumerate(string.lowercase, start=1))
english_dict = open('/usr/share/dict/words', 'rU')
@talentwill
talentwill / VIP.php
Created July 18, 2017 17:48
优酷、爱奇艺、搜狐、腾讯等各大视频网站VIP视频解析源代码
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($user_agent, 'MicroMessenger') === false) {
echo '
<center><h1>输入各大视频网站VIP视频链接即可观看</h1></center>
@talentwill
talentwill / wxpy_group.py
Created May 10, 2017 16:24 — forked from youfou/ad_urls.json
响应好友请求 / 自动聊天 / 限制频率 / 邀请入群 / 远程群管理 / 新人欢迎消息 / 关键词问答 / 发心跳 / 远程命令 / 远程执行代码
#!/usr/bin/env python3
# coding: utf-8
"""
wxpy 机器人正在使用的所有代码
可能需要安装开发分支的 wxpy
pip3 install -U git+https://github.com/youfou/wxpy.git@develop
@talentwill
talentwill / bfs.c
Created October 9, 2016 08:59
6. 图的遍历
/* 邻接矩阵存储的图 - BFS */
/* IsEdge(Graph, V, W)检查<V, W>是否图Graph中的一条边,即W是否V的邻接点。 */
/* 此函数根据图的不同类型要做不同的实现,关键取决于对不存在的边的表示方法。*/
/* 例如对有权图, 如果不存在的边被初始化为INFINITY, 则函数实现如下: */
bool IsEdge( MGraph Graph, Vertex V, Vertex W )
{
return Graph->G[V][W]<INFINITY ? true : false;
}
@talentwill
talentwill / 2_1_StackByArray.c
Last active September 28, 2016 07:08
Mooc-数据结构
typedef int Position;
struct SNode {
ElementType *Data; /* 存储元素的数组 */
Position Top; /* 栈顶指针 */
int MaxSize; /* 堆栈最大容量 */
};
typedef struct SNode *Stack;
Stack CreateStack( int MaxSize )
{
@talentwill
talentwill / printN.c
Created September 12, 2016 01:50
PrintN
#include <stdio.h>
void printN1(int N)
{
for (int i = 1; i <= N; ++i)
{
printf("%d\n", i);
}
}
@talentwill
talentwill / go_closure.go
Last active August 17, 2016 15:39
go function
package main
import (
"fmt"
)
func main() {
var fs = [4]func(){}
for i := 0; i < 4; i++ {
@talentwill
talentwill / sed.sh
Last active August 15, 2016 10:20
删除每行前几个字符
# 从第10行开始,到最后,删除每行前25个任意字符
sed -i '10,$s/^.\{25\}//' test.txt
# 替换包含BTS字段的行为-
sed -i '/.*BTS.*/s/.*/-/g' syslog_Enb_syslog_1.log