Skip to content

Instantly share code, notes, and snippets.

View ty0x2333's full-sized avatar
🎯
Focusing

Tian Yiyan ty0x2333

🎯
Focusing
View GitHub Profile
@ty0x2333
ty0x2333 / Launch Custom URL.html
Created September 27, 2015 18:24
Chrome外部应用协议安装和卸载脚本
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Launch Custom URL </title>
<script type="text/javascript">
function LaunchURLScript(){
var url = "TyStart:";
window.open(url);
self.focus();
}
@ty0x2333
ty0x2333 / StringGenerate.html
Created September 27, 2015 18:50
批量文本生成器(HTML)
<html>
<head>
<title>String Generate</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
@ty0x2333
ty0x2333 / Tyy批量重命名安装卸载器.bat
Last active September 28, 2015 21:35
右键菜单-文件批量重命名 的 安装\卸载 脚本
@echo off
echo =====================================================
echo 批量重命名
echo By luckytianyiyan@gmail.com
echo =====================================================
echo 1. 正在检查权限...
Rem 创建文件路径
set TempFile_Name=%SystemRoot%\System32\BatTestUACin_SysRt%Random%.batemp
Rem 写入文件
@ty0x2333
ty0x2333 / make_windows_ico.bat
Created January 15, 2016 20:09
The script will be generated under the Windows of ICO.
@echo off
echo The script will be generated under the Windows of ICO
convert logo.png ( -clone 0 -resize 256x256 ) ( -clone 0 -resize 128x128 ) ( -clone 0 -resize 96x96 ) ( -clone 0 -resize 64x64 ) ( -clone 0 -resize 32x32 ) -delete 0 logo.ico
@ty0x2333
ty0x2333 / platform.js
Last active February 15, 2016 13:20
JaveScript detect platform and cpu class.
function detectOS() {
var sUserAgent = navigator.userAgent;
var isWin = (navigator.platform === "Win32") || (navigator.platform === "Windows");
var isMac = (navigator.platform === "Mac68K") || (navigator.platform === "MacPPC") || (navigator.platform === "Macintosh") || (navigator.platform === "MacIntel");
var isIpad = sUserAgent.match(/ipad/i) === "ipad";
// var isIphoneOS = sUserAgent.match(/iphone os/i) === "iphone os";
var isUnix = (navigator.platform === "X11") && !isWin && !isMac;
var isLinux = (String(navigator.platform).indexOf("Linux") > -1);
var isAndroid = sUserAgent.toLowerCase().match(/android/i) === "android";
@ty0x2333
ty0x2333 / make_favicon
Last active February 16, 2016 13:49
The script will be generated under the website of ICO
#!/bin/sh
echo The script will be generated under the website of ICO
convert icon.png \
\( -clone 0 -resize 16x16 \) \
\( -clone 0 -resize 32x32 \) \
\( -clone 0 -resize 48x48 \) \
\( -clone 0 -resize 64x64 \) \
-delete 0 -colors 256 favicon.ico
set iconcache=%localappdata%\IconCache.db
rem Close explorer
taskkill /f /im explorer.exe
rem Remove Icon Cache
attrib -h -s -r "%iconcache%\IconCache.db"
del /f "%iconcache%\IconCache.db"
attrib /s /d -h -s -r "%iconcache%\Microsoft\Windows\Explorer\*"
del /f "%iconcache%\Microsoft\Windows\Explorer\thumbcache_32.db"
del /f "%iconcache%\Microsoft\Windows\Explorer\thumbcache_96.db"
del /f "%iconcache%\Microsoft\Windows\Explorer\thumbcache_102.db"
@ty0x2333
ty0x2333 / 1ximage.py
Last active February 24, 2017 02:23
1ximage.py
#!/usr/bin/env python
# https://gist.github.com/luckytianyiyan/212cef95e7a85ef5a92cbb0c9e1033c4
import os
import fnmatch
import argparse
__author__ = 'luckytianyiyan@gmail.com'
__version__ = '0.2.0'
@ty0x2333
ty0x2333 / delete_app_extension.rb
Last active March 16, 2017 12:29
CLI Remove XCode App Extension
#!/usr/bin/env ruby
# https://gist.github.com/luckytianyiyan/59aad64e2871c45318958b765e0c8d1f
# Author: luckytianyiyan
# License: MIT
require 'xcodeproj'
project_path = ARGV[0]
project = Xcodeproj::Project.open(project_path)
main_target_name = ARGV[1]
dependency_target_name = ARGV[2]
#!/bin/sh
# https://gist.github.com/luckytianyiyan/8b27ef55465aec6bd77b6452b3d547f7
PATH=$PATH:/usr/local/bin
IFS=$'\n'
if [ ! $(command -v convert) ]; then
echo "❗️ convert command not found"
echo "brew install imagemagick"
exit 1