rsync -P -e ssh local_file user@host:remote_file
Wednesday, May 10, 2017
How to Resume an SCP Transfer
Monday, August 3, 2015
How to upload vhd or file in Azure China
Step 1:
Step 2:
Step 3:
Step 4:
azure storage account connectionstring show --blob-endpoint gfw.blob.core.chinacloudapi.cn mcops
Step 2:
azure storage blob upload -c '<step1 string>' -f /tmp/coreos_production_azure_image.vhd --container test --blobtype page
Step 3:
azure vm image create -f -u https://gfw.blob.core.chinacloudapi.cn/vm-images/coreos_production_azure_image1.vhd -f -v CoreOS-Latest --location "China North" --os Linux https://gfw.blob.core.chinacloudapi.cn/vm-images/coreos_production_azure_image.vhd azure vm image create myimage --blob-url https://myaccount.blob.core.chinacloudapi.cn/mycontainer/ImageName.vhd --os linux
Step 4:
azure vm create <dnsname> <imagename> -u <vmusername> -p <vmpassword> -l <location>
Friday, July 10, 2015
Starting with Strace
What is strace?
Strace is a “system call trace” program. It attaches to a process and tracks system calls and signals made to and from it (and possibly it’s children). There are limitations to strace, some of which are detailed below. However, strace can be a very valuable tool for determining the root cause of many issues. This post only covers very basic usage of strace. The example used here can be done using jailshell.
What is a process?
For the purposes of this tutorial, a process is a unique instance of program being run, identified on the system by a unique process identifier (pid). For more information seehttp://www.linfo.org/process.html and http://en.wikipedia.org/wiki/Process_identifier
What is a system call?
A system call is how a program requests that the operating system kernel perform a task for it. There are quite a few “normal” tasks that the operating system kernel does for programs regularly, including extremely common file operations like reading and writing. More information regarding system calls can be found at: http://en.wikipedia.org/wiki/System_call
What information can strace capture? Not capture?
Strace can tell you
- what files and network connections were opened, closed, or attempted
- what was read from and written to from said files and connections
Strace cannot tell you what is happening inside the process. It is not a debugger and is not aware of the variables used inside the process.
What do I have to know before I can use strace?
Strace is a power tool in your troubleshooting bag. But it’s not the most basic tool. General troubleshooting (checking log files, researching error messages, etc) should be done before attempting to solve a problem with strace. Before using strace, you’ll need to be able to reliably reproduce the issue so that you can catch it with strace. You’ll also need to determine what process to strace (covered later).
When am I not able to use strace?
In addition to there being times when strace will not be helpful, there are a few scenarios when you can not use strace. While most normal processes can be attached to by strace, there are some exceptions.
You cannot attach to a process in these scenarios:
- when a debugger or other tracing program is already attached
- when you do not own the process, unless you are running the strace as root
- when the system has special protections preventing strace from being used to gather information
Resource considerations
Output files created by strace files do get very big very quickly, but more importantly are the numerous writes that strace output produces. This i/o hit is not mitigated (and is frequently made worse) by outputting to the terminal instead of a file.
Before you start to strace
Ensuring strace is installed
You can determine if strace is installed by typing:
strace -V
If strace is installed, you’ll see something like: strace — version 4.5.19. If it’s not installed, you’ll see something like bash: strace: command not found. Install strace with:
yum install strace
This command does require root access, so if you do not have root, you will need to request that your web hosting provider install strace for you.
Tuesday, June 30, 2015
Trace zabbix server
objdump -DSswx zabbix_server | gzip -c > zabbix_server.objbump.gz
Monday, June 29, 2015
iOS code sign error - User interaction not allowed
Earlier today I was trying to build an iOS application over VPN, SSH or Bamboo (Jenkins), I was connected to my iMac at work. I was running a command line script that I had written in order to automate the build process and facilitate deployment to our network server. This involved a B2B application, so not something that would go into the App Store.
Anyway, I had built the application like this, it resulted in an .app file:
Next I signed this .app and packaged it into an .ipa file:
This resulted in an error:
The key to solving this problem was unlocking the keychain access in order for the user to be able to sign applications. You can do this like this:
Note:
Anyway, I had built the application like this, it resulted in an .app file:
$> xcodebuild -target "$APP_NAME" -sdk iphoneos -configuration Release
Next I signed this .app and packaged it into an .ipa file:
$> xcrun -sdk iphoneos PackageApplication -v "$APP_NAME.app" -o "$APP_NAME.ipa" --sign "iPhone Distribution"
This resulted in an error:
$> build/Release-iphoneos/$APP_NAME.app: User interaction is not allowed
The key to solving this problem was unlocking the keychain access in order for the user to be able to sign applications. You can do this like this:
$> security unlock-keychain /Users/$USER/Library/Keychains/$KEYCHAIN.keychain
Note:
- replace $APP_NAME with the name of your application
- replace $USER with the name of your local user account, I used 'fred'
- replace $KEYCHAIN with the name of the target keychain, I used 'login'
Location:
香港
Wednesday, December 31, 2014
use vmnet patch with vmware 10.0.4 and kernel 3.17
diff -ur vmnet-only.a/netif.c vmnet-only/netif.c
--- vmnet-only.a/netif.c 2014-10-10 03:23:08.585920012 +0300
+++ vmnet-only/netif.c 2014-10-10 03:23:09.245920008 +0300
@@ -149,7 +149,7 @@
memcpy(deviceName, devName, sizeof deviceName);
NULL_TERMINATE_STRING(deviceName);
- dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
+ dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_UNKNOWN, VNetNetIfSetup);
if (!dev) {
retval = -ENOMEM;
goto out;
- tar xf /usr/lib/vmware/modules/source/vmnet.tar -C /tmp/vmware
- patch vmnet-only.a/netif.
- tar -cf vmnet.tar vmnet-only/ cp vmnet.tar /usr/lib/vmware/modules/source/
- # vmware-modconfig --console --install-all
Wednesday, July 16, 2014
Stop gvfsd-metadata Using 100% CPU and Disk High I/O
If your Linux system is slowly grinding to a halt, and you manage to pull up the System Monitor and see that gvfsd-metadata is using 100% of the CPU, here’s how to correct it. In a terminal run the following 2 commands:
rm -rf ~/.local/share/gvfs-metadata pkill gvfsd-metadataYour system should now be back to normal.
Friday, May 30, 2014
The best command to create raw datafile used by Oracle database
Oracle recommends creating new datafiles on devices with zero offset. The command "/usr/sbin/mklv -y LVname -T O -w n -s n -r n VGname NumPPs" can be used. Please contact Oracle customer support for more details.
Friday, May 9, 2014
AIX make filesystem
List PV (Disk)
use smitty manfs make a filesystem, then mount
bash-3.2# lspv hdisk0 0056b0de849951c7 rootvg active hdisk1 0056b0dee1558f91 rootvg active hdisk5 0056b0de8d3ad7c5 datavg2 active hdisk6 0056b0de8d3b2189 datavg activeuse smit vg to make new vg View vg information
bash-3.2# lsvg datavg VOLUME GROUP: datavg VG IDENTIFIER: 0056b0de00004c0000000145e01e8ee2 VG STATE: active PP SIZE: 1024 megabyte(s) VG PERMISSION: read/write TOTAL PPs: 1673 (1713152 megabytes) MAX LVs: 256 FREE PPs: 1172 (1200128 megabytes) LVs: 2 USED PPs: 501 (513024 megabytes) OPEN LVs: 0 QUORUM: 2 (Enabled) TOTAL PVs: 1 VG DESCRIPTORS: 2 STALE PVs: 0 STALE PPs: 0 ACTIVE PVs: 1 AUTO ON: yes MAX PPs per VG: 32512 MAX PPs per PV: 2032 MAX PVs: 16 LTG size (Dynamic): 1024 kilobyte(s) AUTO SYNC: no HOT SPARE: no BB POLICY: relocatableview vg's lv
bash-3.2# lsvg -l datavg datavg: LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT test1 jfs2 500 500 1 closed/syncd /test1 loglv00 jfs2log 1 1 1 closed/syncd N/Ause smitty mklv make a new LV
use smitty manfs make a filesystem, then mount
Thursday, April 24, 2014
Use Click Package to Write Beautiful Command Application with Python
click is a Python package for creating beautiful command line interfaces in a composable way with as little amount of code as necessary. It’s the “Command Line Interface Creation Kit”. It’s highly configurable but comes with good defaults out of the box.
Install
pip install clickHello world Sample
import click
@click.command()
@click.option('--count', default=1, help='number of greetings')
@click.option('--name', prompt='Your name',
help='the person to greet', required=True)
def hello(count, name):
for x in range(count):
print('Hello %s!' % name)
if __name__ == '__main__':
hello()
You can find quickstart and full docs here.
Friday, April 4, 2014
Monday, March 31, 2014
How to trace a user login in oracle database
trace oracle user login
alter session set tracefile_identifier='login_test'; alter session set events '10046 trace name context forever ,level 12' conn fucker/larry alter session set events '10046 trace name context off' ;
Thursday, March 6, 2014
Auto Kill Bloking Session on Oracle Database with SQL
DECLARE
CURSOR c1 IS select process,sid,serial#, blocking_session from v$session where blocking_session is not null;
i NUMBER:= 0;
BEGIN
FOR e_rec IN c1 LOOP
i:= i+1;
EXECUTE immediate 'ALTER SYSTEM KILL SESSION ' ||''''|| e_rec.sid ||','|| e_rec.serial# ||''' ';
END LOOP;
END;
/
Wednesday, February 26, 2014
Download Movabletype Old Version
You must buy MT6. It's not a opensource soft from MT6. But you can download MT1-MT6 RC here.
http://movabletype.org/downloads/archives/
http://movabletype.org/downloads/betas/
http://movabletype.org/downloads/archives/
http://movabletype.org/downloads/betas/
Sunday, February 16, 2014
How to earn online
- Join an affiliate program.
- Choose free offers (easier for you to get earning)
- Create a review for that product on Blogspot.
- Promote that page.
Free traffic sources:
- Forums
- Social Networks
- Video Sharing Sites
- PDF Sharing Sites
- Article Directories
- Offline
- Answers Sites
- Groups
- Blog Comments (set Google alerts)
- Learn SEO and rank that blog.
Sunday, December 1, 2013
A $45 Linux SSD Laptop from China
Last week a Chinese computer company sell a laptop with $45.
There is some english information about the laptop.
There is some english information about the laptop.
Lemote ultra mini-laptop is powered by the latest design-by-China 64-bit Loongson-2F processor which speeds at 900MHz.The integrated DDR 2 and PCI 2 controllers and independently designed Northbridge chipsets.
Product characteristics:
- Strong computing:
It employs the latest Loongson-2F processor, 64-bit, four-issue Out-Of-Order structure and integrated memory controller. - Energy saving and environmental friendly:
Less than 20 W, which is one tenth of an ordinary PC. The materials are ROHS compliant. - Quiet operation:
Less than 60 db. - security:
Yeeloong 8089 is a safe computing device. On one hand, the hardware components including chipset and matching motherboard are designed by Lemote wholly, which lowers the risico's being intruded by various viruses. On another hand, by employing GNU Linux operating system, it is almost immune to viruses. - Infinite customization:
The unique programmable Northbridge provides space for customization; the operation and application of free operating system could adopt a free open-source software (FOSS), which is a powerful software package management mechanism that provides the most convenient methods for users' customization and development demands to exempt from getting into the trouble of software copyright. - low cost:
The entire product, including processor, system, software and so on, are all designed by Lemote. The cost for software, hardware and synthesized usage cost is only of an ordinary PC.
Specifications
- Processor: Loongson 2F CPU, 900MGHz, integrated DDR II and PCI 2 controllers;
- Memory slots: SO-DIMM DDR2, 512MB;
- South bridge: AMD CS5536;
- Display: 1024 x 600, 8,9" TFT LCD;
- Network: Rtl8139 + RTL8187B(wifi);
- Interface: USB2.0x3, earphone+MIC, SDx1, RJ45x1, VGAx1, DC-inx1; SD reader supports SDHC.
- Storage: 8G SSD;
- Graphics: SMI712
- Webcam: Webcam with 300K pixel
- SD: Realtek RTS5158E
- Size: 25,2 x 3 x 18,5cm
- Weight: 1 kg
- Operating Systems: Debian Linux; Loonux; Red Flag Linux;
- Full power: less than 20 W;
- USB: 2 x USBBattery: 3 Cell Lithium.
Application field
It could be used as ordinary laptop as well as professional computing device for users who have higher demand for security and software customization such as institutions, prototype product development, government, corporate R & D, high education, financial and security organizations etc.Tuesday, October 29, 2013
How to Empty Postfix Mail Queue
mailq | tail +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" } { if ($8 == "email@address.com" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -
sudo postsuper -d ALL
ifconfig | grep netmask | grep -v 127.0.0.1 | awk {'print $2'}L
Monday, October 28, 2013
Saturday, October 5, 2013
How to count mail on queue
sudo find /var/spool/postfix/deferred/. ! -name . ! -name '?' -print | wc -l
Monday, July 8, 2013
Sending and Receiving Data use Java socket programming
//java socket client example
import java.io.*;
import java.net.*;
public class socket_client
{
public static void main(String[] args) throws IOException
{
Socket s = new Socket();
String host = "dev.easy-conn.com";
PrintWriter s_out = null;
BufferedReader s_in = null;
try
{
s.connect(new InetSocketAddress(host , 6557));
System.out.println("Connected");
//writer for socket
s_out = new PrintWriter( s.getOutputStream(), true);
//reader for socket
s_in = new BufferedReader(new InputStreamReader(s.getInputStream()));
}
//Host not found
catch (UnknownHostException e)
{
System.err.println("Don't know about host : " + host);
System.exit(1);
}
//Send message to server
String message = "GET hosts\r\n\r\n";
s_out.println( message );
System.out.println("Message send");
//Get response from server
String response;
while ((response = s_in.readLine()) != null)
{
System.out.println( response );
}
}
}
Subscribe to:
Posts (Atom)

