Skip to content

Instantly share code, notes, and snippets.

View Cojad's full-sized avatar
🤣
Hacking for blockchain

Jason Chiang Cojad

🤣
Hacking for blockchain
View GitHub Profile
@Cojad
Cojad / line.sh
Last active February 22, 2017 04:43
設定時間自動在OSX對Line視窗按下Enter按鍵
#!/usr/bin/php
<?php
$stage=0; //如果不要有語音提醒把 $stage=0; 改成 $stage=1;
$USA=false;
($USA) ? date_default_timezone_set("America/New_York") : date_default_timezone_set("Asia/Taipei");
echo
"==================== 自動切換至line視窗, 並且按下Enter ========================
+ usage: line
+ 在下一個分零秒整, 切換到line視窗, 並且按下Enter
@Cojad
Cojad / mac_office2011_uninstall.sh
Created November 24, 2016 05:12
Remove Office 2011 completely
#!/bin/sh
# IMPORTANT!!!
# This script try to wipe out all office 2011 files but would also delete some other Microsoft files.
# So you are adviced to reinstall other microsoft product which not belong to office 2011.
osascript -e 'tell application "Microsoft Database Daemon" to quit'
osascript -e 'tell application "Microsoft AU Daemon" to quit'
osascript -e 'tell application "Office365Service" to quit'
#Closes all Office applications
osascript -e 'tell application "Microsoft Excel.app" to quit without saving'
@Cojad
Cojad / child_values.js
Last active September 7, 2016 08:55
list hierarchy javascript object values
child = function(obj,name){
for( var index in obj){
switch(typeof obj[index]) {
case "object": child(obj[index],name+"."+index);break;
case "string": console.log(name+"."+index+" = \"" + obj[index] + "\"");break;
case "number": console.log(name+"."+index+" = " + obj[index]);break;
case "boolean": console.log(name+"."+index+" = \""+ (obj[index]) ? "true":"false" + "\"");break;
}
}
}
@Cojad
Cojad / PHP_delete_a_folder_recursively
Last active August 29, 2015 13:58
A simple function to delete a folder recursively. Very danger! Watch out!
<?php
// A simple function to delete a folder recursively. Very danger! Watch out!
// PHP用遞迴把資料夾給砍掉,殺傷力強大,請謹慎使用。
// V1.1 use readdir() instead of glob() for better non-english file name support in php4
// source unknown, modified by Jason Chiang
// xcojad at gmail.com
$folder_name="PEAR";
$folder_name="upload";
@Cojad
Cojad / git-cache-meta.sh
Last active October 16, 2021 08:11 — forked from andris9/git-cache-meta.sh
git-cache-meta -- simple file meta data caching and applying.
#!/bin/sh -e
#git-cache-meta -- simple file meta data caching and applying.
#Simpler than etckeeper, metastore, setgitperms, etc.
# 2014-02-25 change filetime from accessed time to modifpeied time by cojad
# 2012-03-05 - added filetime, andris9
#modified by n1k
# - save all files metadata not only from other users
# - save numeric uid and gid
#from http://www.kerneltrap.org/mailarchive/git/2009/1/9/4654694