Skip to content

Instantly share code, notes, and snippets.

@thinkhy
thinkhy / tedSubtitle.pl
Last active October 6, 2017 14:59
Get subtitle for TED video
#!/usr/local/bin/perl
################################################################################
# File: tedSubtitle.pl
# Desscription: Get ted talk's subtitle from TED.com
# and convert subtitle of TED video to SRT format(SubRip Subtitle File)
# Usage: ted.pl URL languageCode output.src
# Creator: Thinkhy
# Date: 2011.04.30
# ChangeLog: 1 Add language code. [thinkhy 2011.05.06]
# 2 Read advertisement time from the parameter of introDuration in html.
import socket
import struct
import json
def unpack_varint(s):
d = 0
for i in range(5):
b = ord(s.recv(1))
d |= (b & 0x7F) << 7*i
if not b & 0x80:
@seeekr
seeekr / apache-webp-rewrite.conf
Last active March 10, 2024 22:34
enabling apache to serve WebP image files if accepted by browser (and .webp files available)
## !! This snippet has been updated, but not tested in practice. It should work, please check / leave comments in case it doesn't. !! ##
# originally from https://groups.google.com/a/webmproject.org/group/webp-discuss/browse_thread/thread/196ac4ea705688d8
<IfModule mod_rewrite.c>
# TODO: don't forget to put
# AddType image/webp .webp
# in your mods-available/mime.conf
# (though this is optional because we're setting
# the mime type manually in the RewriteRule)
@dannvix
dannvix / intercept-https-with-python-mitmproxy.md
Last active February 16, 2023 02:43
Intercept and manipulate HTTPs traffic with Python and mitmproxy

Intercepts HTTPs Traffic with Python & mitmproxy

Warning

This Gist is created in 2014, and it's highliy outdated now, according to one of mitmproxy's manjor contributor (check his comment below). Thanks for letting us know, @mhils!

Introduction

Modern applications usually make use of back-end API servers to provide their services. With a non-transparent HTTPs proxy, which intercepts the communication between clients and servers (aka the man-in-the-middle scheme), you can easily manipulate both API requests and responses.

@christianroman
christianroman / test.py
Created May 30, 2013 16:02
Bypass Captcha using 10 lines of code with Python, OpenCV & Tesseract OCR engine
import cv2.cv as cv
import tesseract
gray = cv.LoadImage('captcha.jpeg', cv.CV_LOAD_IMAGE_GRAYSCALE)
cv.Threshold(gray, gray, 231, 255, cv.CV_THRESH_BINARY)
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyz")
api.SetPageSegMode(tesseract.PSM_SINGLE_WORD)
tesseract.SetCvImage(gray,api)
print api.GetUTF8Text()

#我的 Vim 指令筆記

##vim 的三種模式 ###模式

  • 輸入模式:輸入內文。
  • 指揮模式:也叫指令模式,主要是進入到可以對文件做修改,複製,剪下貼上,游標移動等動作。
  • 執行模式:文件存檔,離開等等行為。

###常用模式的切換

  • 輸入模式 -> 指揮模式 : 鍵盤 Esc
@hallazzang
hallazzang / README.md
Last active March 25, 2023 02:40
How to make LOL(League of Legends) chat bot (in Python)

How to make LOL(League of Legends) chat bot

  1. Install xmpppy module for python. (Manually download it from Downloads Page or try easy_install xmpppy)
  2. Create a script file. (Ex. lol_echo_bot.py)
  3. Follow steps below.

Import xmpp.

@davidzech
davidzech / InternalLoLTimers
Created April 23, 2014 02:36
Curses stuipd League of Legends hack
using Coherent.UI.Binding;
using Curse.Companion.Scripting;
using Curse.CurseClient.Shared;
using Curse.Logging;
using Curse.Tools.LoL;
using EasyHook;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@mid-kid
mid-kid / minecraft-chat-client.py
Last active February 27, 2024 14:36
Basic minecraft chat client written in Python.
#!/usr/bin/env python3
"""
Simple script that implements the minecraft protocol
to create a basic chat client for said game.
No encryption, no online mode, no parsing of chat messages.
I tried to make it as extendable as possible, so hack away.
PEP8 Note: Ignored E302 (2 newlines between functions)
"""
@franmontiel
franmontiel / PersistentCookieStore.java
Last active April 1, 2024 05:40
A persistent CookieStore implementation for use in Android with HTTPUrlConnection or OkHttp 2. -- For a OkHttp 3 persistent CookieJar implementation you can use this library: https://github.com/franmontiel/PersistentCookieJar
/*
* Copyright (c) 2015 Fran Montiel
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software