Skip to content

Instantly share code, notes, and snippets.

View annidy's full-sized avatar
💭
I may be slow to respond.

fengxing annidy

💭
I may be slow to respond.
View GitHub Profile
@annidy
annidy / pcm-wav.py
Created November 30, 2023 02:15
pcm转wav工具
import wave
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", required=True, help="input pcm file")
parser.add_argument("-o", "--output", required=False, help="output wav file")
parser.add_argument("-s", "--sample_rate", type=int, default=16000, help="sample rate")
parser.add_argument("-c", "--num_channels", type=int, default=1, help="number of channels")
parser.add_argument("-w", "--sample_width", type=int, default=2, help="sample width")
args = parser.parse_args()
@annidy
annidy / battery.py
Last active November 2, 2023 04:42 — forked from wangqr/battery.py
Python script to get battery status on Windows
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import ctypes
from ctypes import wintypes
class SYSTEM_POWER_STATUS(ctypes.Structure):
_fields_ = [
('ACLineStatus', wintypes.BYTE),
('BatteryFlag', wintypes.BYTE),
@annidy
annidy / String+Extensions.swift
Created February 3, 2023 15:13 — forked from Winchariot/String+Extensions.swift
Encode String for URL param or request body
//Both implementations thanks to https://useyourloaf.com/blog/how-to-percent-encode-a-url-string/
//Upgraded/cleaned up for Swift 4
Extension String {
func percentEncodedForRFC3986() -> String? {
let unreserved = "-._~/?"
var allowed = CharacterSet.alphanumerics
allowed.insert(charactersIn: unreserved)
return self.addingPercentEncoding(withAllowedCharacters: allowed)
}
@annidy
annidy / test.m
Last active January 30, 2023 03:25
NSCharacterSet example
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
@annidy
annidy / srb.py
Created November 10, 2016 12:24
ASLR修正lldb脚本
#!/usr/bin/python
#coding:utf-8
import lldb
import commands
import optparse
import shlex
import re
# 获取ASLR偏移地址
def get_ASLR():
# 获取'image list -o'命令的返回结果
@annidy
annidy / notepad2.py
Created September 28, 2012 03:58
反文件透明加密
# -*- coding:utf-8 -*-
from pydbg import *
from pydbg.defines import *
import os
import sys
__author__ = 'fengxing <anndiy(at)gmail.com>'
__date__ = '2012-9-28'
def handler_MapViewOfFile(dbg):
@annidy
annidy / h264_sps_parser.h
Last active March 19, 2022 20:13
my sps parser ext
/*
* h264_sps_parser.h
*
* Copyright (c) 2014 Zhou Quan <zhouqicy@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@annidy
annidy / gist:30471a1e6995211886325ae73f3a23ee
Created November 17, 2021 02:37
example download git branch source code
bash -c 'set -o pipefail && (git archive --remote=git@github.com:annidy/ObjCSameCodeFinder.git --format=tar master | tar -x)'
//cc -Wextra -o build/dump-header-map dump-header-map.c
// see: https://github.com/llvm-mirror/clang/blob/release_40/include/clang/Lex/HeaderMapTypes.h
// https://github.com/llvm-mirror/clang/blob/release_40/include/clang/Lex/HeaderMap.h// https://github.com/llvm-mirror/clang/blob/release_40/lib/Lex/HeaderMap.cpp
// This is basically dump() from there.
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <err.h>
@annidy
annidy / ShowDerivedData.rb
Created October 27, 2021 07:04 — forked from caius/ShowDerivedData.rb
A script for showing the derived data folder for an Xcode workspace. Intended to be invoked from a custom behaviour
#!/usr/bin/env ruby
# This script currently only works if you have your derived data in the default location.
# Get the workspace name to search for, or exit with code 1 if no value in envariable
xcodeWorkspacePath = ENV["XcodeWorkspacePath"] || exit(1)
projectName = xcodeWorkspacePath[%r{/(\w+)\.xcodeproj}, 1]
#Get the folders in derived data that could match the workspace
derived_data = File.expand_path("~/Library/Developer/Xcode/DerivedData")
# Glob out the files matching our project