Skip to content

Instantly share code, notes, and snippets.

@ptz0n
ptz0n / gist:1217080
Created September 14, 2011 16:51
Validate JSONP Callback
<?php
/**
* Validate JSONP Callback
*
* https://github.com/tav/scripts/blob/master/validate_jsonp.py
* https://github.com/talis/jsonp-validator/blob/master/src/main/java/com/talis/jsonp/JsonpCallbackValidator.java
* http://tav.espians.com/sanitising-jsonp-callback-identifiers-for-security.html
* http://news.ycombinator.com/item?id=809291
*
@parano
parano / gist:1868242
Created February 20, 2012 07:18
Excel表格密码保护的解除方法
表格受密码保护时,我们修改数据Excel弹出“您试图更改的单元格或图表受保护,因而是只读的。
若要修改受保护单元格或图表,请先使用‘撤消工作表保护’命令(在‘审阅’选项卡的‘更改’组中)来取消保护。
可能会提示输入密码。这时候我们可以用VBA宏代码破解法来破解表格保护密码:
第一步:打开该文件,先解除默认的“宏禁用”状态,方法是点击工具栏下的“选项”状态按钮,
打开“Microsoft Office安全选项”窗口,选择其中的“启用此内容”,“确定”
再切换到“视图”选项卡,点击“宏”→“录制宏”,出现“录制新宏”窗口,在“宏名”定义一个名称为:
PasswordBreaker,点击“确定”退出;
第二步:再点击“宏”→“查看宏”,选择“宏名”下的“PasswordBreaker”并点击“编辑”,
打开“Microsoft Visual Basic”编辑器,用如下内容替换右侧窗口中的所有代码:
@legastero
legastero / send_image.py
Last active October 10, 2021 16:12
Send an image in a chat message with SleekXMPP
import logging
import threading
import sleekxmpp
logging.basicConfig(level=logging.DEBUG)
class Bot(sleekxmpp.ClientXMPP):
def __init__(self, jid, password):
  1. Plain Strings (207): foo
  2. Anchors (208): k$
  3. Ranges (202): ^[a-f]*$
  4. Backrefs (201): (...).*\1
  5. Abba (169): ^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
  6. A man, a plan (177): ^(.)[^p].*\1$
  7. Prime (286): ^(?!(..+)\1+$)
  8. Four (199): (.)(.\1){3}
  9. Order (198): ^[^o].....?$
  10. Triples (507): (^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
@dantmnf
dantmnf / duppkt.rb
Created December 20, 2014 12:12
script to duplicate outgoing TCP packets
#!/usr/bin/env ruby
require 'socket'
require 'pcaprub'
require 'packetfu'
IDENTIFY_TTL = 105
interface = 'eth0'
DUPS = 1 # number of duplicated packet(s)
SIOCGIFINDEX = 0x8933
@tuxzz
tuxzz / ruce_pcode
Created July 10, 2015 09:30
RUCE_PCode
Function main(arg)
{
/* 解析参数 */
RUCE_UnitParam para = RUCE_ParsePara(arg);
/* 从输入文件名提出音名 例如a.wav变成a */
String inputPath = para.input;
String outputPath = para.output;
String inputFileName = BaseFromFilePath(inputPath);
String inputDirName = DirFromFilePath(inputPath);
@karpathy
karpathy / min-char-rnn.py
Last active April 29, 2024 06:50
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@gumblex
gumblex / zip64.py
Created November 14, 2015 11:16
Simple Python command line utility to create Zip64 files.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Simple command line utility to create Zip64 files.
For Python 3.3+
Most code are from the standard library `zipfile` and `shutil`.
"""
@endel
endel / conver.pe
Last active January 21, 2024 06:37
FontForge script to convert .ttf file to its webfont variations (.otf, .svg, .woff, .woff2)
#!/usr/local/bin/fontforge
Open($1)
Generate($1:r + ".otf")
Generate($1:r + ".svg")
Generate($1:r + ".woff")
Generate($1:r + ".woff2")
@jaksi
jaksi / main.go
Created December 23, 2016 17:32
Go web server
package main
import (
"bytes"
"crypto/tls"
"crypto/x509"
"fmt"
"io/ioutil"
"log"
"net/http"