vim /etc/apt/source.list deb http://ppa.launchpad.net/easystroke/ppa/ubuntu karmic main deb-src http://ppa.launchpad.net/easystroke/ppa/ubuntu karmic main apt-get install easystroke
Tag Archives: tutorials
Adobe AiR SDK linux ubuntu config
- Copy and replace air sdk to flex sdk
- Fix air sdk runtimes:
rm FLEX_SDK/runtimes/air/mac ln -s FLEX_SDK/runtimes/air/mac FLEX_SDK/runtimes/air/linux
Adobe AiR update
main Application:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="checkForAppUpdate()">
<mx:Script>
<![CDATA[
import air.update.events.UpdateEvent;
import air.update.ApplicationUpdaterUI;
private var appUpdater:ApplicationUpdaterUI = new ApplicationUpdaterUI;
// checks to see if an updated version of the app is up.
private function checkForAppUpdate():void
{
appUpdater.configurationFile = new File(app:/updateConfig.xml);
appUpdater.isCheckForUpdateVisible = false;
appUpdater.initialize();
appUpdater.addEventListener(UpdateEvent.INITIALIZED, onUpdate);
appUpdater.addEventListener(ErrorEvent.ERROR, onError);
}
// if there's an error to the update show an alert
private function onError(event:ErrorEvent):void
{
Alert.show(event.toString());
}
// check to see if updated is needed
private function onUpdate(event:UpdateEvent):void
{
appUpdater.checkNow();
}
]]>
</mx:Script>
</mx:WindowedApplication>
updateConfig.xml (with your src, compiled at build):
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://ns.adobe.com/air/framework/update/configuration/1.0">
<url>http://somewhereOnTheInternet.com/aDirectory/aDirectory/appUpdate.xml</url>
<delay>0.5</delay>
<defaultUI>
<dialog name="checkForUpdate" visible="false" />
<dialog name="downloadUpdate" visible="false" />
<dialog name="downloadProgress" visible="false" />
<dialog name="installUpdate" visible="false" />
<dialog name="fileUpdate" visible="false" />
<dialog name="unexpectedError" visible="true" />
</defaultUI>
</configuration>
Delay is per day. .5 is half day, .02 = half an hour.
appUpdate.xml (to be placed somewhere on your site):
<?xml version="1.0" encoding="utf-8"?>
<update xmlns="http://ns.adobe.com/air/framework/update/description/1.0">
<version>v1.0</version>
<url>http://somewhereOnTheInternet.com/aDirectory/aDirectory/myApplication.air</url>
<description>
<![CDATA[
This is where your description goes.
]]>
</description>
</update>
Apt-mirror setup local ubuntu package repository
Server setup
sudo apt-get install apache2 sudo apt-get install apt-mirror sudo vim /etc/apt/mirror.list deb http://archive.ubuntu.com/ubuntu karmic main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu karmic-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu karmic-updates main restricted universe multiverse sudo apt-mirror sudo vim /etc/cron.d/apt-mirror 0 4 * * * apt-mirror /usr/bin/apt-mirror > /var/spool/apt-mirror/var/cron.log #daily 04:00 AM sudo ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu/ /var/www/ubuntu
Client setup
sudo vim /etc/apt/source.list deb http://192.168.1.3/ubuntu karmic main restricted universe multiverse deb http://192.168.1.3/ubuntu karmic-updates main restricted universe multiverse deb http://192.168.1.3/ubuntu karmic-security main restricted universe multiverse sudo links http://192.168.1.3/ubuntu
NFS Server Client Tutorial
NFS Server
Install NFS Server Support
sudo apt-get install nfs-kernel-server nfs-common portmap
Editing /etc/exports
sudo vim /etc/exports /files 192.168.1.0/24(rw,no_root_squash,async) sudo /etc/init.d/nfs-kernel-server restart sudo exportfs -a
NFS client
Install NFS client support
sudo apt-get install portmap nfs-common sudo mount server.mydomain.com:/files /files sudo /etc/init.d/portmap restart sudo /etc/init.d/nfs-common restart
Mounting at boot using /etc/fstab
sudo vim /etc/fstab server.mydomain.com:/files /files nfs rsize=8192,wsize=8192,timeo=14,intr
Tomcat 6 Ubuntu install for multiple instances
Install SUN JAVA6 JDK
root@h apt-get install sun-java6-jdk
Install TOMCAT6 user instances
root@h: apt-get install tomcat6-user
Add new user:
root@h: adduser tomcatA
Create TOMCAT6 user instance:
tomcatA@h: tomcat6-instance-create tomcat
Tomcat configure(port):
tomcatA@h: vim tomcat/conf/server.xml
Tomcat start/stop:
tomcatA@h: ./tomcat/bin/startup.sh tomcatA@h: ./tomcat/bin/shutdown.sh
Add to autostart:
root@h: vim /etc/init.d/tomcatA
#!/bin/bash
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sudo -u tomcatA /home/tomcatA/tomcat/bin/startup.sh
;;
stop)
sudo -u tomcatA /home/tomcatA/tomcat/bin/shutdown.sh
;;
restart)
sudo -u tomcatA /home/tomcatA/tomcat/bin/shutdown.sh
sudo -u tomcatA /home/tomcatA/tomcat/bin/startup.sh
;;
esac
exit 0
root@h: chmod +x /etc/init.d/tomcatA
Update init.d scripts
sudo update-rc.d tomcatA defaults
Tar tutorial
Create, Extract, See Contents
The tar program takes one of three funcion command line arguments (there are two others I won’t talk about).
- c – to create a tar file, writing the file starts at the beginning.
- t – table of contents, see the names of all files or those specified in other command line arguments.
- x – extract (restore) the contents of the tar file.
Compression, Verbose, File specified
In addition to a function command line argument the arguments below are useful. I usually use z and f all the time, and v when creating/extracting.
- f — specifies the filename (which follows the f) used to tar into or to tar out from; see the examples below.
- z — use zip/gzip to compress the tar file or to read from a compressed tar file.
- v — verbose output, show, e.g., during create or extract, the files being stored into or restored from the tar file.
Examples
To tar all .cc and .h files into a tar file named foo.tgz use:
tar cvzf foo.tgz *.cc *.h
To see a tar file’s table of contents use:
tar tzf foo.tgz
To extract the contents of a tar file use:
tar xvzf foo.tgz
link: http://www.cs.duke.edu/~ola/courses/programming/tar.html
Maven deploy with ftp
in
vim ~/.m2/settings.xml
add
<settings>
...
<servers>
<server>
<id>ftp-repository</id>
<username>user</username>
<password>pass</password>
</server>
</servers>
</settings>
in project file:
vim pom.xml
add
...
</dependencies>
...
<distributionManagement>
<repository>
<id>ftp-repository</id>
<url>ftp://ftpServerA.com</url>
</repository>
</distributionManagement>
...
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-alpha-6</version>
</extension>
</extensions>
</build>
...
mvn deploy
link: http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ftp.html
Ssh keys authorization
// generujemy swój klucz ssh ssh-keygen //na wszystkie pytania odpowiadamy enterem //wynik otrzymujemy w: ~/.ssh$ ls -al id_rsa // klucz prywatny id_rsa.pub // klucz publiczny //kompiujemy klucz publiczny na serwer scp ~/.ssh/id_rsa.pub remoteuser@remotehost:~/ //dopisujemy go kluczy na serwerze cat id_rsa.pub >> ~/.ssh/authorized_keys //usuwamy plik na serwerze rm id_rsa.pub //włączamy autoryzację po kluczach w sudo vim /etc/ssh/sshd_config RSAAuthentication yes PubkeyAuthentication yes //restartujemy ssh na serwerze /etc/init.d/ssh reload //teraz logując się po ssh na serwer nie będzie pytania o hasło![]()
Screen tips
* Uruchamimay program w screen.
screen -S torrent rtorrent screen <opcje> <parametry> <nazwa programu>
* Wyście ze screen’a:
ctrl + a, d
* Powrót do screen’a:
screen -x torrent
* Lista screen’nów:
screen -list
* Powrót do screen’a z listy:
screen -x 31234
* Po uruchomieniu pierwszego screen’a jesteśmy w konsoli 0;
* Aby otrzymać następną konsolę w screen’ie robimy:
ctrl + a, c
* Przełączamy się między konsolami przy pomocy:
ctrl + a, # // # - oznacza numer konsoli
* Aby usunąć konsolę:
exit