Skip to content

Instantly share code, notes, and snippets.

View syneart's full-sized avatar

Jed Hong syneart

  • SentraSmart Inc.
  • Taipei, Taiwan
View GitHub Profile
@syneart
syneart / Constellation_main.java
Last active March 31, 2016 17:28
星座判斷
public class Constellation_main {
public static void main(String[] args) {
System.out.println(getConstellationFromDate("10/01"));
}
private static String getConstellationFromDate(String strBirthday) {
int intBirthday = Integer.valueOf(strBirthday.replace("/",""));
if (intBirthday < 11 | intBirthday > 1231) {
@syneart
syneart / editTextBox.vb
Created November 16, 2014 12:19
設定指定名稱 TextBox 的屬性
Const n As Integer = 7 'edit this
For i As Integer = 0 To n
DirectCast(Me.Controls("TextBox" & n), System.Windows.Forms.TextBox).Text = 0
Next
@syneart
syneart / Shuffle.java
Created February 6, 2015 06:15
小數值打亂程式碼片段 (Android/Java)
int MaxVal = 5; // Max
ArrayList<Integer> list=new ArrayList<Integer>();
for (int i = 1; i <= MaxVal; i++) {
list.add(i);
}
Collections.shuffle(list);
for(Integer result:list) {
Log.e("ValOut", result+""); // Result
}
@syneart
syneart / xargs_kill.sh
Last active November 7, 2020 09:53
with grep result, kill process
# if you want to kill all process with name "inetsim"
ps -aux | grep inetsim | grep -v grep | awk '{print $2}' | sudo xargs kill -9
@syneart
syneart / PHPDeBugOnOff.sh
Created May 17, 2016 13:04
Turn On or Off php display_errors parameter on Ubuntu (to quick turn on display PHP error messages or not).
#!/bin/bash
DISPLAY_ERRORS_VAL=`grep display_errors.*=.* '/etc/php5/apache2/php.ini'`
clear
echo "Info: 目前 ${DISPLAY_ERRORS_VAL}";
echo "Info: 修改檔案需要權限, 請先輸入密碼 .."
sudo -v
if [ $? -eq 1 ]; then
clear
echo "Error: 未輸入正確密碼, 無法繼續執行"
sleep 3
@syneart
syneart / mountISO.sh
Created May 17, 2016 13:08
This is a mount iso files bash for Ubuntu.
#!/bin/bash
clear
echo "Please input the iso file in here [Nothing input will unmount]"
read -p ">> " srcinputfile
clear
mntPath=/media/isofileceh
if ["$srcinputfile" == ""] 2>/dev/null ; then
sudo umount "$mntPath" 1>/dev/null 2>/dev/null
sudo rmdir "$mntPath" 1>/dev/null 2>/dev/null
echo The iso file is unmounted !
@syneart
syneart / UpdateUbuntuKernel.sh
Created May 17, 2016 13:10
Remove all Ubuntu older linux kernels and Update to the latest kernel.
#!/bin/bash
clear
echo "Info: 移除和更新核心檔案需要權限, 請先輸入密碼 .."
sudo -v
if [ $? -eq 1 ]; then
clear
echo "Error: 未輸入正確密碼, 無法繼續執行"
sleep 3
exit 0
fi
@syneart
syneart / FixChromeShortcut.sh
Created May 17, 2016 13:12
修正 Google Chrome 在 Ubuntu Unity (user interface) 所產生的捷徑錯誤
#!/bin/bash
clear
echo "Info: 修改檔案需要權限, 請先輸入密碼 .."
sudo -v
if [ $? -eq 1 ]; then
clear
echo "Error: 未輸入正確密碼, 無法繼續執行"
sleep 3
exit 0
fi
@syneart
syneart / cm.bat
Created July 22, 2016 17:32
Lazy FullScreen
@ECHO OFF&mode con cols=15 lines=1
SET TMP_FILE=%tmp%\cm.bat
SET FILE=%1
SET FILE_EXT=%~x1
IF NOT "%~s0"=="%TMP_FILE%" (
COPY %0 %TMP_FILE% 1>nul 2>&1
start/min %TMP_FILE% %FILE%
EXIT
)
@syneart
syneart / LinkItSmart7688_Isolate_Issue_reslove.md
Last active September 5, 2016 08:27
Disable LinkIt Smart 7688 LAN client isolation with AP mode

Disable LinkIt Smart 7688 LAN client isolation with AP mode

This is the the doc for LAN client isolation issue with AP mode on LinkIt Smart 7688 temporary solution.

Usage

  1. Factory reset or configure 7688(or 7688 Duo)'s Wi-Fi to AP mode.

  2. SSH login to 7688(or 7688 Duo)'s shell.