2019年6月21日 星期五

noip for ubuntu

note for myself

Install noip2 from source

  • cd /usr/local/src/
  • wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
  • tar xf noip-duc-linux.tar.gz
  • cd noip-2.1.9-1/
  • make install
If you get make not found or missing gcc then you do not have the gcc compiler tools on your machine. At https://help.ubuntu.com/community/InstallingCompilers you can find install instructions if you need help.

Configure the Client

As root (or with sudo) issue the below command:
/usr/local/bin/noip2 -C (dash capital C, this will create the default config file)

Create a Systemd service

Create the file /etc/systemd/system/noip2.service and paste the following:
[Unit]
Description=No-IP Dynamic DNS Update Client
Wants=network-online.target
After=network-online.target

[Install]
WantedBy=multi-user.target
Alias=noip.service

[Service]
Type=forking
ExecStart=/usr/local/bin/noip2
Restart=always

Activating

 $ systemctl daemon-reload
$ systemctl status noip2.service
$ systemctl start noip2.service (start immediately)
$ systemctl enable noip2.service (start on boot)
 

            
# Simple No-ip.com Dynamic DNS Updater
#
# By Nathan Giesbrecht (http://nathangiesbrecht.com)
#
# 1) Install binary as described in no-ip.com's source file (assuming results in /usr/local/bin)
# 2) Run sudo /usr/local/bin/noip2 -C to generate configuration file
# 3) Copy this file noip2.service to /etc/systemd/system/
# 4) Execute `sudo systemctl daemon-reload`
# 5) Execute `sudo systemctl enable noip2`
# 6) Execute `sudo systemctl start noip2`
#
# systemd supports lots of fancy features, look here (and linked docs) for a full list:
# http://www.freedesktop.org/software/systemd/man/systemd.exec.html
[Unit]
Description=No-ip.com dynamic IP address updater
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
Alias=noip.service
[Service]
# Start main service
ExecStart=/usr/local/bin/noip2
Restart=always
Type=forking
 

2016年12月27日 星期二

Learning Python is fun!

Python + Pyqt 

Apparently, this is a note for myself to memorize something.

  • big5中文當成字串比對時,才會正確
# -*- coding: utf8 -*-
 
import sys
reload(sys)
sys.setdefaultencoding('utf-8')

  •   Using win's app
import subprocess
 buttonCancel.clicked.connect(eventB)

def eventB():
    appW= subprocess.call(r'C:\Program Files\Autodesk\Maya2013\bin\maya.exe',shell=True )

  •  get all the drives in win
import os
dri_all = [ '%s:' % d for d in dri_all if os.path.exists('%s:' % d)]

  •  Decryption and Encryption
import win32com.client
def encrypt(key,content): # key,content
    EncryptedData = win32com.client.Dispatch('CAPICOM.EncryptedData')
    EncryptedData.Algorithm.KeyLength = 5
    EncryptedData.Algorithm.Name = 2
    EncryptedData.SetSecret(key)
    EncryptedData.Content = content
    return EncryptedData.Encrypt() def decrypt(key,content): # key,content
    EncryptedData = win32com.client.Dispatch('CAPICOM.EncryptedData')
    EncryptedData.Algorithm.KeyLength = 5
    EncryptedData.Algorithm.Name = 2
    EncryptedData.SetSecret(key)
    EncryptedData.Decrypt(content)
    str = EncryptedData.Content
    return str
s1 = encrypt('lovebread', 'hello world')
s2 = decrypt('lovebread', s1)
print s1,s2
# MGEGCSsGAQQBgjdYA6BUMFIGCisGAQQBgjdYAwGgRDBCAgMCAAECAmYBAgFABAgq
# GpllWj9cswQQh/fnBUZ6ijwKDTH9DLZmBgQYmfaZ3VFyS/lq391oDtjlcRFGnXpx
# lG7o
# hello world

  • ComboBox 
using self.comboBox.activated.connect(self.XXX) #self.XXX is the function will be the slot

def XXX(self. idx):  #idx is the singal sended from the comboBox
        print 'singal is:' idx

  • QTreeWidget
       For custom Item

itemList = []
for fileName in os.listdir(os.path.expanduser("~/"):filePath = os.path.join(os.path.expanduser("~/"), fileName) lineCount = sum(1 for line in open(filePath))item = QtGui.QTreeWidgetItem() item.setData(0, 0, fileName) item.setData(1, 0, str(lineCount)) itemList.append(item) 
 
 
 
 

2015年11月10日 星期二

Useful Links For Everthing

https://github.com/JuppOtto/Google-Cardboard/blob/master/Autowalk.cs -----Unity C++

http://danielborowski.com/posts/create-a-virtual-reality-game-for-google-cardboard/  ---Unity






GUI.Label(Rect(430,320,500,500),"<color=green><size=100>Win</size></color>");


GUI.Label(Rect(400,470,500,500),"<color=green><size=35>Your scores : 
</size></color>"+"<color=black><size=35>"+player_script.points+"</size></color>");

2015年1月22日 星期四

三星手機Mega5.8修復

1.變磚的修復

先進入手機挖礦模式,odin刷入對岸國行5件包(I9152ZCUAM3),開完機之後,進入RECOVERY,WIPE使用者資料,再回到挖礦模式,先刷入中華"KERNEL-BRI-I9152ZSUAMG3-1373258692.tar",直接關機,再回到挖礦,刷入"I9152ZSUAMG3_I9152OZSAMG3_I9152ZSUAMG3_HOME.tar.md5",成功後就救回了。



2.Samsung手機的工廠模式(Factory Mode)開啟狀態--修復方式
  (按電源鍵不會出現選單,直接就會關機;鎖螢幕無法適用....)

首先要有root的權限,才能修復此問題。
使用任一個檔案總管軟體,開啟-----/efs/FactoryApp/資料夾下的 factorymode 這個檔案,以文字編輯器把: OFF 改成 ON 然後存檔. 重開機即可(都是大寫英文字母)



2013年1月17日 星期四

Cockroach

There are two of my favorite pictures that I have taken for fun. Most people don't like cockroach so much, me either. But after I saw this picture, I was surprised by the transparent shell they have. Nature is so amazing!

2013年1月15日 星期二

New born spiders

This is a picture about new born spiders!

When I was doing recycling, I saw those new born spiders beside the garbage can. It was my first time to see this amazing scene. I quickly took my macro lens and took many pictures for those new comers. I hope everyone likes it.