Skip to content

Instantly share code, notes, and snippets.

View ElfSundae's full-sized avatar
:octocat:
🤔

Elf Sundae ElfSundae

:octocat:
🤔
View GitHub Profile
@ElfSundae
ElfSundae / phpdocs_facade_generator.php
Last active March 17, 2022 08:02 — forked from ardzz/phpdocs_facade_generator.php
PHPDocs facades laravel generator
<?php
/**
* Class FacadePHPDocs
*
* @author Ardhana <ardzz@indoxploit.or.id>
*/
class FacadePHPDocs{
/**
* @var ReflectionClass
@ElfSundae
ElfSundae / bin2hex.sh
Created December 28, 2019 02:15 — forked from dstebila/bin2hex.sh
Shell script to convert binary to hex
#!/bin/bash
# Read either the first argument or from stdin (http://stackoverflow.com/questions/6980090/bash-read-from-file-or-stdin)
cat "${1:-/dev/stdin}" | \
# Convert binary to hex using xxd in plain hexdump style
xxd -ps | \
# Put spaces between each pair of hex characters
sed -E 's/(..)/\1 /g' | \
# Merge lines
tr -d '\n'
@ElfSundae
ElfSundae / import-iOS-Runtime-Headers.sh
Created December 2, 2019 13:27
Import iOS Runtime Headers repository
#!/bin/bash
MyDir="/data/projects/iOS/iOS-Runtime-Headers"
UpstreamDir="/data/projects/github/iOS/iOS-Runtime-Headers"
TAGS=(10.0 10.1 10.2 10.3 11.4)
DIRS=(Frameworks lib PrivateFrameworks protocols)
_task()
{
@ElfSundae
ElfSundae / git-checkout-all-branches.sh
Last active September 19, 2023 23:10
Git checkout all remote branches
#!/bin/bash
remote=origin ; for brname in `git branch -r | grep $remote | grep -v /master | grep -v /HEAD | awk '{gsub(/^[^\/]+\//,"",$1); print $1}'`; do git branch --track $brname $remote/$brname || true; done 2>/dev/null
@ElfSundae
ElfSundae / FourCCString.m
Created November 13, 2019 07:59
FourCharCode to String
// https://developer.apple.com/documentation/avfoundation/avassettrack/1386694-formatdescriptions?language=objc
static NSString * FourCCString(FourCharCode code) {
NSString *result = [NSString stringWithFormat:@"%c%c%c%c",
(code >> 24) & 0xff,
(code >> 16) & 0xff,
(code >> 8) & 0xff,
code & 0xff];
NSCharacterSet *characterSet = [NSCharacterSet whitespaceCharacterSet];
return [result stringByTrimmingCharactersInSet:characterSet];
}
@ElfSundae
ElfSundae / check_TXLiteAVSDK_UGC_pod_source.sh
Created October 18, 2019 11:57
Check TXLiteAVSDK_UGC Pod source
#!/bin/sh
#
# Check TXLiteAVSDK_UGC pod source
#
# $ pod spec which TXLiteAVSDK_UGC
# ~/.cocoapods/repos/trunk/Specs/a/3/e/TXLiteAVSDK_UGC/6.7.7754/TXLiteAVSDK_UGC.podspec.json
## Existing version from CocoaPods Specs:
# 4.2.3427 Free
@ElfSundae
ElfSundae / iOS device models list.json
Created September 29, 2019 08:43
iOS device models list - iPhone, iPad, iPod touch, ⌚️ Apple Watch, 🖥 Apple TV model
{
"AppleTV2,1": "Apple TV 2",
"AppleTV3,1": "Apple TV 3",
"AppleTV3,2": "Apple TV 3",
"AppleTV5,3": "Apple TV 4",
"AppleTV6,2": "Apple TV 4K",
"iPad1,1": "iPad",
"iPad2,1": "iPad 2",
"iPad2,2": "iPad 2",
"iPad2,3": "iPad 2",
@ElfSundae
ElfSundae / cn2pinyin.php
Created December 1, 2011 02:33
cn2pinyin
<?php
/**
*
* 中文转换为拼音
*
*/
function cn2pinyin($_String, $_Code='gb2312') {
$_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha" .
"|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|" .
"cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er" .