Skip to content

Instantly share code, notes, and snippets.

@luxiao
luxiao / lua_tobignum.lua
Last active August 11, 2022 03:55
lua tonumber can't handle big integer
function tobignum(v, f, step)
-- 自带tonumber遇到大整数溢出
-- v is a md5 hexdigest value, f is base format like binary or hex, use step to slice v
if f == nil then
f = 16
end
if step == nil then
step = 8
end
local len = string.len(v)
@luxiao
luxiao / asymmetric.py
Created June 8, 2017 08:20
rsa encrypt and decrypt
# -*- coding: utf-8 -*-
# requirements: cryptography==1.4
from cryptography.hazmat.primitives import serialization, hashes
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.backends import default_backend
from cryptography.exceptions import InvalidSignature
from collections import OrderedDict
import json
from base64 import b64decode, b64encode
@luxiao
luxiao / html_table_rowspan_colspan.py
Last active February 9, 2018 08:26
format html table with rowspan or colspan
from bs4 import BeautifulSoup
'''
format table with rowspan or colspan to [[]] two dimension lists with the same number td in tr.
html表格格式化,有合并单元格的表格拆分出来,组成td元素个数一致的规整表格。
'''
def test_rowspan():
html_data_row = '''<table border="1">
<tr> <td>Montd</td> <td>Savings</td> <td>Savings for holiday!</td> </tr>
<tr> <td>January</td> <td>$100</td> <td rowspan="2">$50</td> </tr>
<tr> <td>February</td> <td>$80</td> </tr> </table>'''
@luxiao
luxiao / nginx.conf
Created March 27, 2018 08:51 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@luxiao
luxiao / tmux-cheatsheet.markdown
Created March 27, 2018 08:57 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@luxiao
luxiao / django_pbkdf2_crack.py
Last active August 29, 2018 07:06
django pbkdf2 crack
# coding: utf-8
import os
import time
from django.contrib.auth.hashers import make_password
from django.conf import settings
settings.configure()
algo = 'pbkdf2_sha256'
ps = 'SecLists/Passwords'
@luxiao
luxiao / macOS Internals.md
Created May 10, 2023 06:29 — forked from kconner/macOS Internals.md
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options: