Cumartesi, Eylül 21, 2013

ubuntu debian basit vnc server kurulmu


$ sudo apt-get install x11vnc vnc-java



kullanıcı şifresi oluşturalım.

$ x11vnc -storepasswd
Enter VNC password:
Verify password:
Write password to /home/kullanici/.vnc/passwd? [y]/n y
çalıştıralım
$ x11vnc -forever -usepw -httpdir /usr/share/vnc-java/ -httpport 5800

sunucumuz hazır.

http://sistem_makine_adresi:5800


Cumartesi, Temmuz 20, 2013

Okunası



Almanya’da bir lise müdürü, her eğitim öğretim yılı başında öğretmenlerine şu mektubu gönderirmiş.

“Bir toplama kampından sağ kurtulanlardan biriyim. Gözlerim hiçbir insanın görmemesi gereken şeyleri gördü. İyi eğitilmiş ve yetiştirilmiş mühendislerin inşa ettiği gaz odaları, iyi yetiştirilmiş doktorların zehirlediği çocuklar, işini iyi bilen hemşirelerin vurduğu iğnelerle ölen bebekler, lise ve üniversite mezunlarının vurup yaktığı insanlar.

Eğitimden bu nedenle kuşku duyuyorum. Sizlerden isteğim şudur.Öğrencilerinizin insan olması için çaba harcayın.Çabalarınız bilgili canavarlar ve becerikli psikopatlar üretmesin. Okuma yazma, matematik, çocuklarınızın daha fazla insan olmasına yardımcı olursa ancak o zaman önem taşır.”

Çarşamba, Temmuz 10, 2013

php online kullanıcı sayısı


$folder = dirname(__FILE__)."/activeusers/";
$timeold=30;   // seconds
$actualtime=date("U");   // seconds since January 1st, 1970.

$ip = "0.0.0.0";
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
if(isset($_SERVER['REMOTE_ADDR'])) $ip = $_SERVER['REMOTE_ADDR'];
file_put_contents ($folder."$ip.$actualtime.txt", "0");

$counter=0;
$ipCounter = array();

$dir = dir($folder);
while($temp = $dir->read()){
if ($temp=="." or $temp==".."){continue;}
$filecreatedtime=date("U", filemtime($folder.$temp));
if ($actualtime>($filecreatedtime+$timeold)){
unlink ($folder.$temp);                                                                   //
}else{
$dataArr = explode('.',$temp);
$dataIp = sprintf('%s', $dataArr[0], $dataArr[0], $dataArr[0], $dataArr[0]);
$ipCounter[$dataIp] += 1;
$counter++;

if($ipCounter[$dataIp]>15) {
echo ":)";
exit(0);
}
}
}

Çarşamba, Mayıs 08, 2013

toplu dosya ismi değiştirme

for i in *.bmp; do convert ${i} ${i%bmp}jpg; done

gelişmiş seçenekler eklenebilir

convert -size 360x85 xc:transparent -font Bookman-DemiItalic -pointsize 72 -draw "text 25,60 'nixCraft'" -channel RGBA -gaussian 0x6 -fill YellowGreen -stroke RosyBrown -draw "text 20,55 'nixCraft'" nixCraft.png

Perşembe, Nisan 25, 2013

How to Compact a VirtualBox Linux Guest’s VDI file

Steps to compact a VDI file:

  1. Zero-fill the virtual machine’s disk using the dd command
  2. Shut down the machine
  3. Use Oracle’s VBoxManage program to compact the VDI
  4. Restart the virtual machine

To zero-fill a linux disk, the most efficient way is to use the dd command, which can write a stream to a file. In this case, we will be writing from the linux pseudo-device /dev/zero to a fill file. Use the following command to zero-fill the disk:

$ dd if=/dev/zero of=fillfile bs=1M

if= specifies the input file, in this case, a stream of zeroes. of= specifies an output file. If you were to specify a drive here, like /dev/sda, it would zero fill the entire drive, so be careful. bs= specifies the block size. In this case, it will write a megabyte of zeroes at a time into fillfile.

Once dd has completed, delete your zero-fill file

This is a minor consideration, done for speed. For future reference, it can be much faster to specify a 512k-1M block size when random filling a drive with dd for data destruction purposes.


Once dd has completed, delete your fill file (which should be taking up all of the free space on the drive at this point) and shut the virtual machine down. Once it’s shut down, run VBoxModify to complete the process. VBoxModify is a very powerful tool, and occupies an entire chapter of the VirtualBox Manual. Compact the VDI using the following command:

$ VBoxManage modifyhd /path/to/your.vdi --compact




When the process is complete, you should have a smaller vdi. If not, something went wrong with the zero-filling process or there was no room to compact your VDI.

Cuma, Mart 15, 2013

Javascript URL Parse

javascript ile url pars etme


var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";

parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"

Çarşamba, Mart 13, 2013

OpenERP Ident authentication failed for user "openerp"



OpenERP kurulumunda
Ident authentication failed for user "openerp"
hatası alıyorsanız pg_hba.conf dosyasında

local all all ident 

satırını

local all all md5


şeklinde deneyin


Cuma, Kasım 02, 2012

openssl Failure Signing Data PEM_do_header bad password

Uncaught exception 'Exception' with message 'Failure Signing Data: error:0906A068:PEM routines:PEM_do_header:bad password read - SHA256

Çözüm

# echo | openssl rsa -in cakey.pem -out cakey.pem
Enter pass phrase for cakey.pem:
writing RSA key

Pazartesi, Eylül 03, 2012

Çarşamba, Ağustos 15, 2012

Cuma, Ağustos 10, 2012

gcp: Ubuntu Linux komut satırı tabanlı dosya kopyalama aracı


Eğer "cp" den özellikleri çok zengin olan bir dosya / klasör kopyalama yardımcı programı arıyorsanız
bu anlamda, "gcp" olarak adlandırılan bu aracı denemelisiniz.
Bu bir komut satırı tabanlı bir araç, ama bir dosya kopyalama işlemi sırasında "cp" ile farklı olarak,
"gcp" giriş / çıkış dosya adları (varsayılan olarak devre dışı),
size tahmini zamanı verir ama en önemlisi de bir ilerleme çubuğu gösterir ve dosya kopyalama hızını daha çabuk hesaplar!.

Ana özellikleri ...

*. Hafif ve oldukça kullanıcı dostu.
*. Dosya ve klasörleri destekler.
*. Tek veya birden fazla (listeler) dosyaları ve klasörleri kopyalayabilirsiniz.
*. Güzel bir ilerleme çubuğu göstermektedir, dosya boyutu, geçerli dosya kopyalama hızı, tahmini süre.
Yani herhangi bir anda neler olduğunu bileceksiniz.
*. Herhangi bir dosya kopyalama hataları karşılaşırsa "GCP" farklı olarak, bir dosya atlamak ve bir sonrakine geçme
yeteneğine sahip.

sudo apt-get install gcp

Birkaç basit örnekler ...

"gcp" nin temel kullanımı aşağıdaki gibidir.

gcp source-file destination

Kullanıcının  "Masaüstü" ndeki "2.iso" adında bir dosyayı  "Ev" klasörüne kopyalamak istediğini varsayalım.

gcp Desktop/2.iso /home/hbasria

ek bir dosya daha varsa, o zaman aşağıdaki biçimde kullanabilirsiniz.

gcp first-file second-file destination

Örneğin, en benim Ev klasöre kopyalamak istediğiniz benim Masaüstü iki dosya ("video.mkv" ve "disk image.iso" olarak adlandırılır) olduğunu varsayalım. Sonra bunun için aşağıdaki komutu kullanmak istiyorum.

gcp Desktop/video.mkv Desktop/disk-image.iso /home/hbasria

Klasörleri kopyalama ...

Bir klasörün içeriğinin kopyalanması oldukça kolaydır. Sadece "cp" olduğu gibi, biz aşağıda formatında "-r" özelliğini kullanabilirsiniz.

gcp -r source-folder destination

Eğer birden fazla klasör varsa.

gcp -r source-folder1 source-folder2 destination


Perşembe, Haziran 14, 2012


Mysql ile bir sütundaki tüm kayıtların baş harfini büyük kalanları küçük yapma


UPDATE `table` SET `name` =
CONCAT(UPPER(LEFT(`name`, 1)), LOWER(SUBSTRING(`name`, 2)))
 WHERE 1

Cumartesi, Mart 17, 2012

VMware Esxi SSH CLI komutları


VMware Esxi SSH CLI komutları

vim-cmd vmsvc/getallvms
Lists all vm’s running on hypervisor and provides vmid

vim-cmd vmsvc/power.off vmid
Powers off vmid referenced from getallvms command

vim-cmd vmsvc/power.on vmid
Powers off vmid referenced from getallvms command

vim-cmd vmsvc/power.reboot vmid
Reboots vmid referenced from getallvms command

vim-cmd vmsvc/destroy vmid
Deletes the vmdk and vmx files from disk

vim-cmd hostsvc/maintenance_mode_enter
Puts hypervisor into maintenance mode

vim-cmd hostsvc/maintenance_mode_exit
Takes hypervisor out of maintenance mode


vim-cmd solo/registervm /vmfs/vol/datastore/dir/vm.vmx
Registers vm in hypervisor inventory

vim-cmd vmsvc/unregister vmid
Unregisters vm with hypervisor

vim-cmd vmsvc/tools.install vmid
Starts vmware tools installation for VM

vim-cmd hostsvc/net/info
Provides information about hypervisor networking

chkconfig -l
Shows daemons running on hypervisor. Can also be used for configuration.

esxtop
Same as linux top for vmware

vmkerrcode -l
List of vmkernel errors

esxcfg-info
Lists a LOT of information about the esx host

esxcfg-nics -l
Lists information about NIC’s. Can also be used for configuration.

esxcfg-vswitch -l
Lists information about virtual switching. Can also be used for configuration.

dcui
Provides console screen to ssh session

vsish
Vmware interactive shell

Çarşamba, Mart 14, 2012

CKeditor UTF8 problem




CKEDITOR.editorConfig = function( config )
{
    config.htmlEncodeOutput = false;
    config.entities = false;
};

yapın gitsin

Pazar, Şubat 26, 2012

PHP: Generate a random password


function generatePassword($length=9, $strength=0) {
    srand((double)microtime()*1000000);
    $chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
    if ($strength > 1) $chars .= 'ABDGHJLMNPQRSTVWXZ';
    if ($strength > 2) $chars .= "!@#$%";
    if ($strength > 3) $chars .= '^&*(-_=+)';
    $i = 0;$key = '';
    while ($i <= $length) {$key .= $chars[rand(0, strlen($chars))];$i++;}
    return $key;  
}


echo generatePassword(9);
echo generatePassword(9,1);
echo generatePassword(9,2);
echo generatePassword(9,3);
echo generatePassword(9,4);
echo generatePassword(50,4);


v6qu8my20e
66qv24hero
QswQeNGX1W
@VdQ$7V1kX
l5(11JLmGV
ww$ec6vbc$oh&cr#_w+g&2chQHn1%9TQGXj*ZmT)tHaBH$7(@

Çarşamba, Şubat 15, 2012

git local repoyu bare yapmak

Önce yedeğinizi alın

$ cd repo
$ git config --bool core.bare true
$ mv .git ../repo.git
$ rm -Rf repo

Pazar, Şubat 05, 2012

live cd den grub kurtarmak

sudo mkdir /mnt/root

sudo mount -t ext3 /dev/sda6 /mnt/root sudo

mount -t proc none /mnt/root/proc

sudo mount -o bind /dev /mnt/root/dev

sudo chroot /mnt/root /bin/bash

grub-install /dev/xxx

Pazartesi, Ocak 30, 2012

Salı, Aralık 20, 2011

Exim giden e-posta gönderme IP sini değiştirme

Dosyaları Oluşturma ve Düzenleme

öncelikle hangi domainin hangi ip adresinden mail göndereceğini belirtmek için aşağıdaki dosyalar lazım


  1. /etc/mailhelo — Exim'in HELO komutunu yapılandırma dosyası. 
  2. /etc/mailips — hangi IP adreslerinden posta gönderilmesi gerektiğini belirten dosya. 


/etc/mailhelo
EXIM bir e-posta sunucu ve istemci arasında diyalog başlatmak için HELO komutunu kullanır. Bu dosya hangi HELO komutunu göndermesi gerektiğini yönetir. Budosyayı oluşturmak için, nano, vi veya vim gibi bir metin düzenleyicisi kullanmanız gerekecektir. Dosyayı aşağıdaki şekildeyapılandırmanız gerekir:


 example.com: example.com
 sub.example.com: example.com
 example.net: example.net
 addon.example.net: example.net
 *: hostname.example.com
/etc/mailips
 example.com: 192.168.0.2
 sub.example.com: 192.168.0.2
 example.net: 192.168.0.3
 addon.example.net: 192.168.0.3
 *: 192.168.0.1

daha sonra exim.conf dan aşağıdaki ayarları yapmak gerekiyor

remote_smtp:
  driver = smtp
  interface = ${if exists {/etc/mailips}{${lookup{$sender_address_domain}lsearch*{/etc/mailips}{$value}{}}}{}}
  helo_data = ${if exists {/etc/mailhelo}{${lookup{$sender_address_domain}lsearch*{/etc/mailhelo}{$value}{$primary_hostname}}}{$primary_hostname}}