2014-04-02

tiny core linux Oracle XE 11R2


SWAP=/mnt/sda1/tmp/swap
MEM=1G

####################################
# load util

st2 glib2 make gcc libaio binutils net-tools
st2 bash sed
st2 bzip2-lib
sudo ln -s /usr/local/lib/libbz2.so /usr/local/lib/libbz2.so.1
sudo ln -s /usr/bin/awk /bin


####################################
# add lib path

sudo ln -s /lib /lib64
#sudo ln -s /usr/local/lib /usr/local/lib64
#sudo ln -s /usr/lib /usr/lib64
#sudo ln -s /var/lib /var/lib64

#echo /u01/app/oracle/product/11.2.0/xe/lib | sudo tee -a /etc/ld.so.conf
#sudo ldconfig


####################################
# Create User oracle:dba

sudo addgroup dba
sudo adduser -D oracle -G dba

sudo passwd -d oracle

echo "
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe

LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib:\$ORACLE_HOME/lib
export LD_LIBRARY_PATH

PATH=\$PATH:/usr/local/bin
export PATH

. $ORACLE_HOME/bin/oracle_env.sh
" | sudo tee -a /home/oracle/.ashrc


####################################
#  install RPM

sudo rpm -i Disk1/oracle-xe-11.2.0-1.0.x86_64.rpm


####################################
#  Create Folder ??

sudo mkdir -p /var/lock/subsys
#sudo mkdir -p /u01/app/oracle/oradata
#sudo mkdir -p /u01/app/oracle/diag
sudo mkdir -p /u01/app/oracle/product/11.2.0/xe/config/log
sudo mkdir -p /u01/app/oracle/product/11.2.0/xe/config/seeddb


####################################
# fix script executable

sudo chmod a+x /u01/app/oracle/product/11.2.0/xe/config/scripts/*.sh
sudo chmod a+x /etc/init.d/oracle-xe

sudo ln -s /u01/app/oracle/product/11.2.0/xe/lib/libagtsh.so.1.0 /u01/app/oracle/product/11.2.0/xe/lib/libagtsh.so


####################################
# change owner to oracle:dba

sudo chown -R oracle:dba /u01


####################################
# set memory

sudo sed -i -e "s/%memory_target%/${MEM}/" /u01/app/oracle/product/11.2.0/xe/config/scripts/init.ora
sudo sed -i -e "s/%memory_target%/${MEM}/" /u01/app/oracle/product/11.2.0/xe/config/scripts/initXETemp.ora


####################################
# set swap

#mkswap $SWAP
sudo swapon $SWAP


####################################
# change kernel setting

echo "250 32000 100 128" | sudo tee /proc/sys/kernel/sem
echo "4294967295" |sudo tee /proc/sys/kernel/shmmax
echo "4096" | sudo tee /proc/sys/kernel/shmmni
echo "2097152" | sudo tee /proc/sys/kernel/shmall
echo "6815744" | sudo tee /proc/sys/fs/file-max
echo "9000 65500" | sudo tee /proc/sys/net/ipv4/ip_local_port_range

cat /proc/sys/kernel/sem \
/proc/sys/kernel/shmmax \
/proc/sys/kernel/shmmni \
/proc/sys/kernel/shmall \
/proc/sys/fs/file-max \
/proc/sys/net/ipv4/ip_local_port_range


####################################
# configure oracle

sudo /etc/init.d/oracle-xe status

sudo /etc/init.d/oracle-xe configure

sudo /etc/init.d/oracle-xe status

# sudo /etc/init.d/oracle-xe start


####################################
# login

# sqlplus system


####################################
# set for remote login

# SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);

2014-03-18

Boot Disk


diskpart
list disk
select disk ?
clean
create partition primary
select partition 1
active
format fs=ntfs quick label=”Win8-RP-x64”
  -- OR -- FS=FAT32
exit

(g: windows 8 DVD)
C:\Windows\system32>g:
G:\>cd boot
  Run "bootsect /help" for detailed usage instructions.

G:\boot>bootsect /nt60 e:
   Target volumes will be updated with BOOTMGR compatible bootcode.
   Bootcode was successfully updated on all targeted volumes.
G:\boot>exit

xcopy g:\*.* e:\ /E /H /F

-----------------------

bcd
bcdedit
bootcfg
fixboot
fixmbr
bootsect


=========================

fdisk
fdisk /mbr
format [/s]
sys

=========================

fdisk
mkfs.ext4

=========================

2014-03-17

GRUB2 multiboot ISO


GRUB2 multiboot ISO 2018 update

USB:
/boot/grub
/boot/iso
/boot/image
/boot/tc4
/boot/tc5
/boot/syslinux

get USB UUID & Label:
> blkid



/boot/grub.sh


/boot/grub/grub.env (1024byte)


/boot/grub/grub.cfg




/boo/grub/grub_hd.cfg (Harddisk)


/boo/grub/grub_fd.cfg (Floppy)



/boo/grub/grub_pe.cfg (Windows PE)

Linux:

/boo/grub/grub_tci.cfg (Tiny Core Linux)

/boo/grub/grub_sl.cfg (Slax)

/boo/grub/grub_u.cfg (Ubuntu)


/boo/grub/grub_d.cfg (Debian)


/boo/grub/grub_cd.cfg (CDLinux)


/boo/grub/grub_cr.cfg (ChromeOS)


/boo/grub/grub_s.cfg (openSUSE)


/boo/grub/grub_ce.cfg (CentOS)
* rdshell
method 1:
set rootopt="root=live:LABEL=CentOS-${ver}-${bit}-${live}"

boot into rdshell

1a: boot from RAM
# mkdir 1 2
# mount /dev/<usb partition> 1
# cp 1/boot/iso/<Centos ISO> 2
# umount 1
  (remove USB)
# exit

1b: boot from USB
# mkdir 1 2
# mount /dev/<usb partition> 1
# mount -o loop 1/boot/iso/<Centos ISO> 2
# exit

method 2:
set rootopt="root=live:${ISO_Path}/${iso}"

boot into rdshell

2a: boot from RAM
# mkdir -p boot/iso 1
# mount /dev/<usb partition> 1
# cp 1/boot/iso/<Centos ISO> boot/iso
# /init

2b: boot from USB
# mkdir -p boot 1
# mount /dev/<usb partition> 1
# ln -s /1/boot/iso /boot
# /init

2014-03-14

Tiny Core Linux QEMU

xorg-server-dev
gettext-dev
glib2-dev
sdl-dev

./configure --prefix=/opt/qemu/qemu --interp-prefix=/opt/qemu/gnemul/qemu-%M

make

make install

/opt/qemu/qemu/bin/qemu-system-i386 -m 128 -cdrom /Source/android/android-x86-4.4-RC1.iso

/opt/qemu/qemu/bin/qemu-img create /mnt/sdb1/vBox/Win8/hd.img 10G


Win8 x86:
qemu-system-i386 -m 1024 -cpu core2duo -cdrom 9600.16384.WINBLUE_RTM.130821-1623_X86FRE_ENTERPRISE_EVAL_ZH-TW-IRM_CENA_X86
FREE_ZH-TW_DV5.ISO


2014-03-13

Windows


Disable Zip:
regsvr32 /u %windir%\system32\zipfldr.dll
regsvr32 %windir%\system32\zipfldr.dll


HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop
ScreenSaveActive
ScreenSaverIsSecure
ScreenSaveTimeOut

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
NoRun
NoSaveSettings

CodePage
950 Big5
949 Korean
936 GBK
932 Shift-JIS
65000 UTF-7
65001 UTF-8
20936 GB2312
437 Eng

1250 — East European Latin
1251 — Cyrillic
1252 — West European Latin
1253 — Greek
1254 — Turkish
1255 — Hebrew
1256 — Arabic
1257 — Baltic
1258 — Vietnamese


MySQL


mysql -u xxx -p

show tables;


生肖 天干 地支

干支年每60年為一個周期,生肖每12年一個周期

天干 甲 乙 丙 丁 戊 己 庚 辛 壬 癸 甲 乙
地支 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
生肖 鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬

天干 丙 丁 戊 己 庚 辛 壬 癸 甲 乙 丙 丁
地支 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
生肖 鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬

天干 戊 己 庚 辛 壬 癸 甲 乙 丙 丁 戊 己
地支 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
生肖 鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬

天干 庚 辛 壬 癸 甲 乙 丙 丁 戊 己 庚 辛
地支 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
生肖 鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬

天干 壬 癸 甲 乙 丙 丁 戊 己 庚 辛 壬 癸
地支 子 丑 寅 卯 辰 巳 午 未 申 酉 戌 亥
生肖 鼠 牛 虎 兔 龍 蛇 馬 羊 猴 雞 狗 豬

Oracle


nls_date_language=american
set NLS_DATE_FORMAT=YYYY-MM-DD HH24:MI:SS
set NLS_LANGUAGE=AMERICAN
set NLS_LANG=AMERICAN.UTF8

@set NLS_LANG=Traditional Chinese_Hong Kong.ZHT16BIG5
@set NLS_LANG=Simplified Chinese_China.ZHS16CGB231280
@set NLS_LANG=Traditional Chinese_Hong Kong.UTF8
@set NLS_LANG=Simplified Chinese_China.UTF8
@set NLS_LANG=Traditional Chinese_Hong Kong.ZHT16BIG5

set NLS_LANG=American_America.UTF8

例:
・日本語(EUC)の場合
unix# setenv LANG 'ja'
unix# setenv LANG 'ja_JP.EUC'
unix# setenv NLS_LANG 'Japanese_Japan.JA16EUC'

・日本語(SJIS)の場合
unix# setenv LANG 'ja_JP.PCK'
unix# setenv LANG 'ja_JP.Shift_JIS'
unix# setenv NLS_LANG 'Japanese_Japan.JA16SJIS'

・日本語(UTF-8)の場合
unix# setenv LANG 'ja_JP.UTF-8'
unix# setenv NLS_LANG 'Japanese_Japan.UTF8'
unix# setenv NLS_LANG 'American_America.UTF8'

・繁体字中国語(Big5)の場合
unix# unset LANG
unix# setenv LANG 'zh_TW.Big5'
unix# setenv NLS_LANG 'Traditional Chinese_Hong Kong.ZHT16BIG5'

・簡体字中国語(GB2312)の場合
unix# unset LANG
unix# setenv LANG 'zh_CN.EUC'
unix# setenv NLS_LANG 'Simplified Chinese_China.ZHS16CGB231280'




===================================


set pagesize 10000
SET SQLBLANKLINES ON
SET SQLBLANKLINES OFF
SET SQLT[ERMINATOR] {;|c|ON|OFF}
set serveroutput on;

set verify off
column segment_name    format a25
column segment_type HEADING "Type"  format a12
column blocks HEADING "Allocated|Blocks" format 999999999
column Used HEADING "Consumed|Blocks" format 999999999
column p HEADING "Percent|Used"  format 999999999

==================================


select sysdate from dual;

===================================

set serveroutput on;
DECLARE
i integer;
begin
i:=1234;
delete from xxx1 where id in (i);
delete from xxx2 where id in (i);
delete from xxx3 where id in (i);
delete from xxx4 where id in (i);
end;
/


DECLARE
i integer;
j integer;
begin
select nvl(id, 999) into i from dual, xxx where id(+)=100000;
if SQL%NOTFOUND THEN
DBMS_OUTPUT.PUT_LINE('SQL%NOTFOUND: ');
END IF;
DBMS_OUTPUT.PUT_LINE('J: ' || i);
end;
/

set serveroutput on;
DECLARE
i integer(10);
begin
i := 0;

XXX(
'001','Remark',i
);
end;
/


BEGIN
DBMS_JOB.CHANGE(
job => 841,
next_date =>  to_date('22-12-2006 18:00:00','dd-Mm-yyyy HH24:MI:SS'),
interval => 'trunc(decode(sign(to_number(to_char(sysdate,''hh24mi''))-1730),1,sysdate+1,sysdate))+18/24',
what => NULL
);
END;
/


select
 trunc(decode(sign(to_number(to_char(sysdate,'hh24mi'))-1730),1,sysdate+1,sysdate))+18/24
from dual;

select
 trunc(decode(sign(to_number(to_char(to_date('2006-12-22 17:32','yyyy-mm-dd hh24:mi'),'hh24mi'))-1730),1,sysdate+1,sysdate))+18/24
from dual;

select to_char(sysdate,'hh24mi') from dual;


alter index xxx rebuild unrecoverable;
alter index xxx rebuild;
alter index xxx rebuild tablespace xxx;


UNDO:

 AS OF TIMESTAMP (TO_TIMESTAMP('2010-04-07 18:10:00', 'YYYY-MM-DD HH24:MI:SS'))

select status,last_update,update_by from xxx AS OF TIMESTAMP (TO_TIMESTAMP('2010-04-07 18:24:55', 'YYYY-MM-DD HH24:MI:SS')) where id=1234;


Squid Reverse Proxy


http_port 80 accel defaultsite=your.main.website

cache_peer ip.of.webserver parent 80 0 no-query originserver name=myAccel

acl our_sites dstdomain your.main.website
http_access allow our_sites
cache_peer_access myAccel allow our_sites
cache_peer_access myAccel deny all


Network


nslookup -q=soa xxx.com 8.8.8.8
nslookup -q=ns xxx.com 8.8.8.8
nslookup -q=mx xxx.com 8.8.8.8
nslookup -q=a www.xxx.com 8.8.8.8


RJ45:
千兆網線的作法
1 白橙 --- 白綠
2   橙 ---   綠
3 白綠 --- 白橙
4   藍 --- 白棕
5 白藍 ---   棕
6   綠 ---   橙
7 白棕 ---   藍
8   棕 --- 白藍

百兆網路線作法
1 白綠 --- 白橙
2   綠 ---   橙
3 白橙 --- 白綠
4   藍 ---   藍
5 白藍 --- 白藍
6   橙 ---   綠
7 白棕 --- 白棕
8   棕 ---   棕


No of      No of
subnets    Hosts/net    netmask
1            254          0.  0.  0.  0 / 0 (00000000.00000000.00000000.00000000)
2            126        128.  0.  0.  0 / 1 (10000000.00000000.00000000.00000000)
4             62        192.  0.  0.  0 / 2 (11000000.00000000.00000000.00000000)
8             30        224.  0.  0.  0 / 3 (11100000.00000000.00000000.00000000)
16            14        240.  0.  0.  0 / 4 (11110000.00000000.00000000.00000000)
32             6        248.  0.  0.  0 / 5 (11111000.00000000.00000000.00000000)
64             2        252.  0.  0.  0 / 6 (11111100.00000000.00000000.00000000)
128            0        254.  0.  0.  0 / 7 (11111110.00000000.00000000.00000000)
256            0        255.  0.  0.  0 / 8 (11111111.00000000.00000000.00000000)

1            254        255.  0.  0.  0 / 8 (11111111.00000000.00000000.00000000)
2            126        255.128.  0.  0 / 9 (11111111.10000000.00000000.00000000)
4             62        255.192.  0.  0 /10 (11111111.11000000.00000000.00000000)
8             30        255.224.  0.  0 /11 (11111111.11100000.00000000.00000000)
16            14        255.240.  0.  0 /12 (11111111.11110000.00000000.00000000)
32             6        255.248.  0.  0 /13 (11111111.11111000.00000000.00000000)
64             2        255.252.  0.  0 /14 (11111111.11111100.00000000.00000000)
128            0        255.254.  0.  0 /15 (11111111.11111110.00000000.00000000)
256            0        255.255.  0.  0 /16 (11111111.11111111.00000000.00000000)

1            254        255.255.  0.  0 /16 (11111111.11111111.00000000.00000000)
2            126        255.255.128.  0 /17 (11111111.11111111.10000000.00000000)
4             62        255.255.192.  0 /18 (11111111.11111111.11000000.00000000)
8             30        255.255.224.  0 /19 (11111111.11111111.11100000.00000000)
16            14        255.255.240.  0 /20 (11111111.11111111.11110000.00000000)
32             6        255.255.248.  0 /21 (11111111.11111111.11111000.00000000)
64             2        255.255.252.  0 /22 (11111111.11111111.11111100.00000000)
128            0        255.255.254.  0 /23 (11111111.11111111.11111110.00000000)
256            0        255.255.255.  0 /24 (11111111.11111111.11111111.00000000)

1            254        255.255.255.  0 /24 (11111111.11111111.11111111.00000000)
2            126        255.255.255.128 /25 (11111111.11111111.11111111.10000000)
4             62        255.255.255.192 /26 (11111111.11111111.11111111.11000000)
8             30        255.255.255.224 /27 (11111111.11111111.11111111.11100000)
16            14        255.255.255.240 /28 (11111111.11111111.11111111.11110000)
32             6        255.255.255.248 /29 (11111111.11111111.11111111.11111000)
64             2        255.255.255.252 /30 (11111111.11111111.11111111.11111100)
128            0        255.255.255.254 /31 (11111111.11111111.11111111.11111110)
256            0        255.255.255.255 /32 (11111111.11111111.11111111.11111111)

Windows Routing / net use

route -f

route -p add 192.168.0.0 mask 255.255.0.0 192.168.1.1

route add 192.168.1.1 mask 255.255.255.255 192.168.2.1

route -p add 0.0.0.0 mask 0.0.0.0 192.168.2.1

net use p: \\192.1681.1\xxx /USER:xxx\xx.xxx

net use \\192.168.1.1 /USER:xxx

net use p: /delete

subst s: /d


Windows AD, DHCP


AD DC

Disabling USB storage on Microsoft Windows:
1. From Explorers folder options ensure that hidden files and folders are displayed, file extensions are not hidden and simple file sharing is disabled.
2. Open up the properties for %systemroot%\Inf\Usbtror.inf (%systemroot% would normally be ‘C:\Windows’).
3. Select the security tab and make sure that all options for all users are set to deny. This must include administrators and SYSTEM.
4. Repeat the above for %systemroot%\Inf\Usbstor.pnf
5. If USB storage devices have been used on this machine previously then open up the registry editor otherwise ignore steps 6 and 7.
6. Browse to the registry location ‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor’.
7. Open up the registry key ‘Start’ and change the data value to ‘4?. Close the registry editor.

If you dont want to simplify the task download and run this usbstoragedisable.reg that will take care of diabling USB storage device. Make sure you restart after running this registry script.

If you want to enable it back then download and run this usbstorageenable.reg. Restart to take effect.

Additionally you need to deny the registry permissions to system for installing USB storage devices. For that, get a copy of subinacl.exe from MS 2003 server resource kit or search microsoft site for this tool.

Here is the command you should run to deny the permissions. Copy it in your batch file and run wherever you want.

subinacl.exe /keyreg \system\currentcontrolset\services\usbstor /deny=system



Pre:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Forceguest 0

IP Static to DHCP
wmic /node:10.0.1.101 /user:User /password:abc123 nicconfig where (ipenabled=true and dhcpenabled=false) call enabledhcp

DNS Auto
wmic /node:10.0.1.101 /user:User /password:abc123 nicconfig where (ipenabled=true and dhcpenabled=true) call setdnsserversearchorder ()

Change Computername
wmic /node:10.0.1.101 /user:user /password:abc123 computersystem where (name="vboxxp") rename name="vboxxp5"

Config DHCP Server

Reboot (No DC)
wmic /node:10.0.1.101 /user:User /password:abc123 os where primary=True call reboot

Join DC
netdom join 10.0.1.101 /Domain:macau_slot.com /UserO:user /PasswordO:abc123 /UserD:macau_slot.com\siduser /PasswordD:Abc!234 /REBoot:5


Reboot (Joined DC)
wmic /node:10.0.1.101 /user:Administrator /password:abc123 os where primary=True call reboot                          






WMIC /node:10.0.1.103 /user:Administrator /password:abc123 ComputerSystem where Name="vboxxp" call Rename Name="vboxxp4"

wmic /node:10.0.1.103 /user:Administrator /password:abc123 OS Where Primary=TRUE Call reboot



==============================


wmic /node:10.0.1.103 /user:Administrator /password:abc123 OS Where Primary=TRUE Call Shutdown

AD
netsh firewall set service remoteadmin enable
netsh firewall set opmode enable



Linux Package Install/Upgrade

yum centos
apt-get ubuntu
zypper openSUSE chrome

cpan perl

Apache Tomcat MySQL

This summary is not available. Please click here to view the post.

Javascript AJAX XMLHTTP

This summary is not available. Please click here to view the post.

VIM / date / sed / grep / awk

vim:
Line Number:
:%s/^/\=line(".")/


date --date="next day"
date --date="1 days ago"
date --date="-1 days ago"
date --date='6 months 15 day'
date --date='2 months 5 day ago'
$ date --date='2 year ago' # past
$ date --date='3 years' # go into future
$ date --date='2 days' # future
$ date --date='1 month ago' # past
$ date --date='2 months' # future

date --set='+30 minutes'
date --date='1970-01-01 00:00:01 UTC +5 hours' +%s



HTTP / SMTP

This summary is not available. Please click here to view the post.

openssl



openssl s_client -connect www.google.com:443 < /dev/null

openssl s_client -quiet -connect www.google.com:443 << ENDL
GET
ENDL

heartbleed:
openssl s_client -connect www.google.com:443 -tlsextdebug 2>&1 < /dev/null | grep -i "server extension"


openssl x509 -text

wget http://www.thawte.com/repository/Thawte_SGC_CA.crt

openssl x509 -inform DER -in Thawte_SGC_CA.crt -text -noout

openssl x509 -inform DER -in Thawte_SGC_CA.crt -noout -purpose


openssl s_client -showcerts -connect xxx:443
openssl x509 -noout -fingerprint -in cert
openssl x509

Self Signed Cert
openssl req \
 -x509 \
 -nodes \
 -newkey rsa:4096 -keyout root.key \
 -days 3650 \
 -set_serial 20111202001 \
 -subj "/C=CN/ST=China/L=Guangzhou/OU=ByeBye/CN=test.org" \
 -out root.pem

GenRSA Key
openssl genrsa -out mykey.pri 4096
openssl rsa -in mykey.pri -out mykey.pub -ouform PEM -pubout

Gen SHA1 Signature
openssl dgst -sha1 -sign mykey.pem -out xxx.sha1 xxx
openssl dgst -sha1 -verify pubkey.pem -signature xxx.sha1 xxx

Encrypt
openssl enc -camellia-256-cbc -d -in odds.camellia-256-cbc


SNMP


snmpwalk -O n -C c -r 10 -t 10 -m dummy -v 1 -c public $H >> "${H}__1--`date +%Y-%m-%d_%H%M`.txt"


TCPDump / WinDump


WinDump.exe -i 5 -nnn -c 100 -s 4096 -XXX dst port 80

WinDump.exe -i 5 -nnn -c 100 -s 4096 -XXX ( dst port 80 or ( port 53 ) )

WinDump.exe -i 5 -nnn -c 100 -s 4096 -XXX port 53

WinDump.exe -i 5 -w office_%date:~0,4%-%date:~5,2%-%date:~8,2%_%time%.dmp -c 100 -s 4096 -XXX dst port 80

WinDump.exe -i 5 -w office_%date:~0,4%-%date:~5,2%-%date:~8,2%_%time:~0,2%%time:~3,2%%time:~6,2%.dmp -c 1000000 -s 4096 ( dst port 80 or ( port 53 ) )



Tiny Core Linux Splunk


SPLUNK_HOME=/opt/splunk
export SPLUNK_HOME

gzip -dc splunk-6.0.1-189883-Linux-x86_64.tgz | tar xfv - -C /opt

cd /opt/splunk
mv var var.bak
mkdir var
sudo mount -t ext4 <dev> var
mv var.bak/* var

bin/splunk start



err* OR crit* OR emer* OR fau* OR fail* OR cpu OR mem* OR limit* | rex mode=sed "s/No matching connection for ICMP error message: icmp src outside:\d+\.\d+\.\d+\.\d+ dst identity:(\d+\.\d+\.\d+\.\d+) \(type \d+, code \d+\) on outside interface\.\s+Original IP payload: .*/No matching connection for ICMP error message: icmp src outside:?.?.?.? dst identity:\1 (type ?, code ?) on outside interface. Original IP payload: .../" | rex mode=sed "s/ detected \d+ output discard/ detected ? output discard/" | rex mode=sed "s/4294\d{3}%/4,???,???%/" | rex mode=sed "s/\s\(\d+-\d+-\d+ \d\d:\d\d:\d\d\)//" | rex field=_raw "^(?<TIME>\d+-\d+-\d+T\d+:\d+:\d+)\.\d+\+\d+:\d+\s+(?<LogHost>\d+\.\d+\.\d+\.\d+)\s+" | rex field=_raw "\s(?<LOG>(?:%|\[\w*\]).*)" | fillnull value="n/a" LOG | stats count, sparkline(count, 2h) as Trend, max(TIME) AS LastTime, max(_time) AS s by host, LOG | sort -s | fields LastTime, host, LOG, count, Trend

xxx  NOT icmp| rex field=_raw "\s(?<Protocol>[\w]+)\ssrc\s+[^ ]+:(?<FromHost>[0-9.]+)(?:/?[0-9]*) dst\s+[^ ]+:(?<ToHost>[0-9./]+) " | fillnull value="n/a" | stats count, sparkline(count) as Trend by FromHost, ToHost, Protocol

\[(?P<Thread>[0-9][0-9])\]\s+<(?P<Time>[0-9][0-9]:[0-9][0-9])\s+(?P<Service>\w+)>\s+(?P<Action>[a-z:]+): Next (?P<RecordFrom>[0-9]+) - (?P<RecordTo>[0-9]+) \(Head (?P<RecordHead>[0-9]+)\)

\s(?P<Type>\w+)\s+(?P<SourceIP>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.(?P<SourcePort>[0-9]{0,5})\s+>\s+(?P<DestIP>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.(?P<DestPort>[0-9]{0,5}):\s+(?P<Flag>.{1,2})\s+(?P<SeqNoLast>[0-9]+):(?P<SeqNo>[0-9]+)\((?P<byte>[0-9]+)\)\s+ack\s+(?P<SeqNoAck>[0-9]+)\s+win\s+(?P<Window>[0-9]+)

\s(?P<Type>\w+)\s+(?P<SourceIP>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.(?P<SourcePort>[0-9]{0,5})\s+>\s+(?P<DestIP>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.(?P<DestPort>[0-9]{0,5}):\s+(?P<Flag>.{1,2})\s+ack\s+(?P<SeqNoAck>[0-9]+)\s+win\s+(?P<Window>[0-9]+)

\s(?P<Type>\w+)\s+(?P<SourceIP>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.(?P<SourcePort>[0-9]{0,5})\s+>\s+(?P<DestIP>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\.(?P<DestPort>[0-9]{0,5}):\s+(?P<Flag>.{1,2})\s+(?P<SeqNoLast>[0-9]+):(?P<SeqNo>[0-9]+)\((?P<byte>[0-9]+)\)\s+win\s+(?P<Window>[0-9]+)

TCP Sequence Randomization

| timechart sum(byte) by SourceIP, SourcePort, DestIP, DestPort

| rex field =_raw "(?P<proto1>\w+) blah (?P<proto2>\w+)" | eval proto=coalesce(proto1, proto2)

| top Flag
| where isnull(Flag)
| where isnotnull(Flag)

| stats sum(byte) as Sum | gauge Sum 200000 400000 600000 800000

... | strcat host "::" port address

| iplocation
status=404 | top 5 referer_domain
status=404 | top 5 referer_domain | search count>2
* | eval kbytes = bytes/1024
gender=female |sort -iq |dedup hair, eyes |eval bmi=weight/height
status=404 | timechart count
status=200 | timechart sum(bytes)
status=200 | timechart sum(bytes) by referer
status=200 | chart sum(bytes) as “Total Bytes” over date_wday
status=200 | chart sum(bytes) over date_wday by referer
status=200 | rare 100 uri | search count>1
status=200 | stats sum(bytes), max(bytes)
status=200 | stats max(bytes) by referer
... | rename _ip as IPAddress
... | replace *localhost with localhost in host
... | dedup host Remove duplicates of results with the same host value.

... | head 20
... | reverse
... | sort ip, -url
... | tail 20

--

props.conf
[my_sourcetype]
...
REPORT-fields = my_fields

transforms.conf
[my_fields]
REGEX = (?m-s)^SPARAM\|\d*\|([^|]+)\|(.*)
FORMAT = $1::$2

--


[get-username]
REGEX = by\s(\w+)\son
FORMAT = username::$1

--

Tiny Core Linux Cups


                st2 cups-pdf

        st2 cups
        st2 ghostscript
        sudo /bin/cp -r ~/.config/cups/ppd /usr/local/etc/cups
        sudo /bin/cp ~/.config/cups/cupsd.conf* /usr/local/etc/cups
        sudo /bin/cp ~/.config/cups/printers.conf* /usr/local/etc/cups
        sudo /bin/cp ~/.config/fx/etc/* /usr/local/etc/cups
        sudo /bin/cp ~/.config/fx/filter/* /usr/local/lib/cups/filter
        sudo cupsd

        cd /home/tc
        ln -s /var/spool/cups-pdf/tc pdf

Tiny Core Linux minicom USB

        sudo touch /usr/local/etc/minirc.s0
        sudo touch /usr/local/etc/minirc.usb0

usb-serial-3.8.13-tinycore.tcz
usb-serial-3.8.13-tinycore64.tcz

Tiny Core Linux LibreOffice


LOsrc=/mnt/tcz/tool/libre/LibreOffice_4.1.4_Linux_x86_rpm.tar.gz
LOrpm=LibreOffice_4.1.4.2_Linux_x86_rpm
LOhome=libreoffice4.1

        gzip -dc ${LOsrc} | tar xfv - -C /opt
        find /opt/${LOrpm} -name \*.rpm -exec sudo rpm -i \{\} \;
        /bin/rm -rf /opt/${LOrpm}
        ln -s ${LOhome} /opt/libreoffice


Tiny Core Linux WinPE

         cabextract
         coreutils
         mkisofs-tools
         mtools
         syslinux
         util-linux

wimlib
imagex

=============================

http://technet.microsoft.com/en-us/library/hh824911.aspx
http://technet.microsoft.com/en-us/library/dd744554(v=WS.10).aspx
http://technet.microsoft.com/en-us/library/dd744252(v=ws.10).aspx
http://technet.microsoft.com/en-us/library/dd744592(v=ws.10).aspx
http://technet.microsoft.com/en-us/library/dd744560(v=ws.10).aspx
http://technet.microsoft.com/en-us/library/dd744284(v=ws.10).aspx

mkdir c:\winpe
cd c:\winpe

copype.cmd x86 c:\winpe\001

cd 001
copy winpe.wim iso\sources\boot.wim

dism /Mount-Wim /WimFile:C:\winpe\001\iso\sources\boot.wim /index:1 /MountDir:C:\winpe\mp

dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-fontsupport-zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-hta.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-legacysetup.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-mdac.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-pppoe.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-scripting.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-setup-client.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-setup-server.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-setup.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-wds-tools.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-wmi.cab"

dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\lp_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-hta_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-legacysetup_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-mdac_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-PPPOE_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-scripting_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-setup-client_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-setup-server_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-setup_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-wds-tools_zh-tw.cab"
dism /image:C:\winpe\mp /Add-Package /PackagePath:"c:\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\zh-tw\winpe-wmi_zh-tw.cab"

dism /image:c:\winpe\mp /Enable-profiling

Dism /Get-MountedWimInfo

dism /Unmount-Wim /MountDir:C:\winpe\mp\ /Commit

http://technet.microsoft.com/en-us/library/dd799303(v=ws.10).aspx

Oscdimg -n -bC:\winpe\001\Etfsboot.com C:\winpe\001\ISO C:\winpe\winpe_waik_x86.iso

Tiny Core Linux VirtualBox


        st2 python
        st2 procps

        # TODO modprode -c

        # fix busybox
        if [ -f /bin/ps -a -f /usr/local/bin/ps ]; then
                sudo mv /bin/ps /bin/ps.busybox
                sudo ln -s /usr/local/bin/ps /bin
        fi

        bzip2 -dc ${VBOXBIN} | sudo tar xfv - -C /

#       bzip2 -dc ${VBOXMISCBIN} | sudo tar xfv - -C /opt/VirtualBox
        sudo insmod ${VBOXMISC}/vboxdrv.ko
        sudo insmod ${VBOXMISC}/vboxnetadp.ko
        sudo insmod ${VBOXMISC}/vboxnetflt.ko
        sudo insmod ${VBOXMISC}/vboxpci.ko

        sudo chmod g-w /opt

        sudo /etc/init.d/vboxdrv status
        sudo /etc/init.d/vboxballoonctrl-service status
        sudo /etc/init.d/vboxweb-service status
        # sudo /etc/init.d/vboxautostart-service start
        sudo /etc/init.d/vboxdrv start



Tiny Core Linux Wifi

        st2 firmware
#       st2 firmware-broadcom_bcm43xx
        st2 firmware-iwlwifi

        st2 wifi
        st2 wl-modules-$PPPR
        st2 iw
        st2 pci-utils

Tiny Core Linux IP Tunnel

A:
ip tunnel del tun0 mode ipip remote 192.168.3.112 local 172.16.0.81

ip tunnel add tun0 mode ipip remote 192.168.3.112 local 172.16.0.81
ip addr add 172.16.1.81/24 peer 172.16.1.112/24 dev tun0
ip link set tun0 up

#route add -net 192.168.1.0/24 gw 172.16.1.112


B:
ip tunnel add tun0 mode ipip remote 192.168.3.115 local 172.16.0.81
ip addr add 172.16.4.81/24 peer 172.16.4.115/24 dev tun0
ip link set tun0 up

route add -net 192.168.4.0/24 gw 172.16.4.115


===============


/sbin/ifconfig ip.tun2 plumb
/sbin/ifconfig ip.tun2 172.16.3.91 172.16.3.81 tsrc 192.168.21.91 tdst 192.168.15.81
/sbin/ifconfig ip.tun2 up

route add net 192.168.3.0/24 172.16.3.81

ip tunnel add tun2 mode ipip remote 192.168.21.91 local 192.168.15.81
ip addr add 172.16.3.81/24 peer 172.16.3.91/24 dev tun2
ip link set tun2 up



/sbin/ifconfig ip.tun0 plumb
/sbin/ifconfig ip.tun0 172.16.1.91 172.16.1.86 tsrc 192.168.2.91 tdst 192.168.6.86
/sbin/ifconfig ip.tun0 up

/sbin/ifconfig ip.tun0 down

/sbin/ifconfig ip.tun0 172.16.1.86 172.16.1.91 tsrc 192.168.6.86 tdst 192.168.2.91

Solaris
/sbin/ifconfig ip.tun1 plumb
/sbin/ifconfig ip.tun1 172.16.2.91 172.16.2.204 tsrc 192.168.2.91 tdst 192.168.1.204
/sbin/ifconfig ip.tun1 up


RedHat:
ip tunnel add tun0 mode ipip remote 192.168.2.91 local 192.168.1.204
ip addr add 172.16.2.204/24 peer 172.16.2.91/24 dev tun0
ip link set tun0 up

echo "1" > /proc/sys/net/ipv4/ip_forward
modprobe ip_nat_ftp
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_conntrack_irc
iptables -t nat -F
iptables -t nat -A POSTROUTING -o eth0 -s 172.16.2.0/24 -j MASQUERADE

route add -net 192.168.3.0/24 gw 172.16.0.1 eth1

Tiny Core Linux Router

                st2 iptables

                sudo ifconfig ${IF2} $GWIP netmask $GWMASK

                echo 'echo "1" > /proc/sys/net/ipv4/ip_forward' > /opt/tcz/ipf
                chmod a+x /opt/tcz/ipf
                sudo /opt/tcz/ipf

                sudo modprobe ip_nat_ftp
                sudo modprobe ip_conntrack
                sudo modprobe ip_conntrack_ftp
                sudo modprobe ip_conntrack_irc

                sudo iptables -t nat -F
                sudo iptables -t nat -A POSTROUTING -o $IF1 -s "$GWSRC" -j MASQUERADE



/sbin/iptables-save -t nat > /home/mrtg/iptable.txt 2>&1

Tiny Core Linux Dev

PPPP=/mnt/sdc1/opt/tcz
PPPF=/mnt/tcz/font
PPPR=3.8.13-tinycore
PPPV=5.x
PPPm=i686
PPPM=x86
PPPL=/opt/tcz/tcz
PPPT=/mnt/tcz/i686/5.x
PPPC=Test
PPPI=eth0
PPPX=7.7
PPPG=32.0.1700.77



        st2 python.tcz

# http://www.tinycorelinux.net/5.x/x86/release/src/kernel/linux-3.8.13-patched.txz
# http://www.tinycorelinux.net/5.x/x86/release/src/kernel/config-3.8.13-tinycore
# http://www.tinycorelinux.net/5.x/x86/release/src/kernel/Module.symvers-3.8.13-tinycore

        st2 linux-kernel-sources-env.tcz
        st2 autoconf.tcz
        st2 automake.tcz
        st2 binutils.tcz
        st2 bison.tcz
        st2 cloog.tcz
        st2 compiletc.tcz
        st2 diffutils.tcz
        st2 e2fsprogs_base-dev.tcz
        st2 expat2.tcz
        st2 file.tcz
        st2 findutils.tcz
        st2 flex.tcz
        st2 gawk.tcz
        st2 gcc.tcz
        st2 gcc_base-dev.tcz
        st2 gcc_libs-dev.tcz
        st2 gcc_libs.tcz
        st2 glibc_base-dev.tcz
        st2 gmp.tcz
        st2 grep.tcz
        if [ "$PPPM" = "x86" ]; then
                st2 linux-3.8.3_api_headers.tcz
        else
                st2 linux-3.8.10_api_headers.tcz
        fi
        st2 m4.tcz
        st2 make.tcz
        st2 mpc.tcz
        st2 mpfr.tcz
        st2 ncurses-common.tcz
        st2 ncurses-dev.tcz
        st2 ncurses.tcz
        st2 patch.tcz
        st2 perl5.tcz
        st2 perl_xml_parser.tcz
        st2 pkg-config.tcz
        st2 ppl.tcz
        st2 sed.tcz
        st2 util-linux_base-dev.tcz
        st2 zlib_base-dev.tcz

if [ 1 = 1 ]; then
        tmp=/mnt/tcz/tool/kernel.src/${PPPM}
        /bin/cp ${tmp}/Module.symvers-${PPPR} \
                ${tmp}/config-${PPPR} \
                ${tmp}/linux-3.8.13-patched.txz \
                /tmp
fi
        sudo linux-kernel-sources-env.sh

        CC=/usr/local/bin/cc
        CPP=/usr/local/bin/cpp
        export CC
        export CPP
        CPPFLAGS="-I/usr/local/src/linux-headers-${PPPR}/include -I/usr/local/src/linux-headers-${PPPR}/arch/${PPPM}/include"
        export CPPFLAGS

        updateFile /home/tc/.ashrc "CC=/usr/local/bin/cc"
        updateFile /home/tc/.ashrc "CPP=/usr/local/bin/cpp"
        updateFile /home/tc/.ashrc "export CC"
        updateFile /home/tc/.ashrc "export CPP"
        updateFile /home/tc/.ashrc "CPPFLAGS=\"-I/usr/local/src/linux-headers-${PPPR}/include -I/usr/local/src/linux-headers-${PPPR}/arch/${PPPM}/include\""
        updateFile /home/tc/.ashrc "export CPPFLAGS"

Tiny Core Linux Partition Label


ext2/ext3 Partitions
There are two commands:
tune2fs -L my_label /dev/partition
/sbin/e2label /dev/partition my_label

Dos Partition Label (mtools better)
dosfstools.tcz
   dosfslabel /dev/xxxx [LABEL]

FAT/FAT16/FAT32 Partitions
You must install the mtools utility package.

Then type
sudo mlabel -i /dev/partition ::my_label

/etc/mtools.conf
drive p: file="/dev/sdb1"

~/.mtoolsrc
mtools_skip_check=1

mlabel p:<label>


NTS Partitions:
You must install the ntfsprogs package

The command to be used is:
ntfslabel /dev/partition my_label.

Tiny Core Linux Openbox


cd ~/.config/openbox/rc.xml
<mouse>
<doubleClickTime>600</doubleClickTime>

cd /usr/local/share/themes/Clearlooks/openbox-3
if [ -f themerc ]; then
  mv themerc themerc.bak
  cp themerc.bak themerc
fi

themerc:
border.width: 2
window.handle.width: 3
# sudo openbox --reconfigure
openbox_restart

Tiny Core Linux extract file


RPM:
rpm2cpio filename.rpm | cpio -vid
  -- OR --
rpm -i filename.rpm

deb:
ar p filename.deb data.tar.gz | tar xz
  -- OR --
ar vx filename.deb
tar -xzvf data.tar.gz

tcz:
  unsquashfs myStartup.tcz
  mksquashfs squashfs-root myStartup.tcz
--OR--
    sudo mount -o loop extension.tcz /tmp/image
    tcz-pack (package-tools.tcz)

lzma:
    tar --lzma -xvf file.tar.lama
  xz -d file.tar.lzma

cab:

ISO: 
sudo mount -t iso9660 -o loop

ISO: udf,iso13346
sudo mount -t udf,iso13346 -o loop

vdi: (qemu.tcz) - use qemu connect the VDI to /dev/nbd?
   rmmod nbd
   modprobe nbd max_part=16
   qemu-nbd [-r] -c /dev/nbd0 <vdi-file>
   mount /dev/nbd0p1 /mnt
   umount /mnt
   qemu-nbd -d /dev/nbd0

initrd.gz/core.gz:  http://wiki.tinycorelinux.net/wiki:remastering
    zcat tinycore.gz | sudo cpio -i -H newc -d
    sudo find | sudo cpio -o -H newc | gzip -2 > ../tinycore.gz

initrd.img:
    mount -t sysfs /inventAnonExistentFilename.whatever targetDirectory/

Tiny Core Linux Flash


FLASHver=11.2.202.335
FLASHver=11.2.202.336
FLASHver=11.2.202.341
FLASHfile=libflashplayer-${FLASHver}.so
FLASHsrc=/mnt/tcz/tool/flash/${FLASHfile}.gz

        sudo mkdir -p /usr/local/share/flash11
        sudo /bin/cp ${FLASHsrc} /usr/local/share/flash11
        sudo gunzip /usr/local/share/flash11/${FLASHfile}.gz
        sudo ln -s ${FLASHfile} /usr/local/share/flash11/libflashplayer.so

Tiny Core Linux Java


JDKsrc=/mnt/tcz/tool/java/jdk-7u51-linux-i586.tar.gz
JREsrc=/mnt/tcz/tool/java/jre-7u51-linux-i586.tar.gz
JDKhome=jdk1.7.0_51
JREhome=jre1.7.0_51
JDKroot=/opt
JREroot=/opt
JAVAPLUGINS=/usr/lib/mozilla/plugins

JRE:
        gzip -dc $JREsrc | tar xfv - -C $JREroot > /dev/null 2>&1
        ln -s $JREhome $JREroot/jre
        ln -s jre $JAVA_HOME

        sudo mkdir -p $JAVAPLUGINS
        sudo ln -s $JAVA_HOME/lib/i386/libnpjp2.so $JAVAPLUGINS

JDK:
        gzip -dc $JDKsrc | tar xfv - -C $JDKroot > /dev/null 2>&1
        ln -s $JDKhome $JDKroot/jdk
        ln -s jdk $JAVA_HOME

        sudo mkdir -p $JAVAPLUGINS
        sudo ln -s $JAVA_HOME/jre/lib/i386/libnpjp2.so $JAVAPLUGINS

Tiny Core Linux Network Boot: DHCPD, TFTPD, Busybox


DHCPD:
        if [ ! -f /etc/udhcpd.conf ]; then
                sudo /bin/cp /mnt/tcz/dhcp/udhcpd.conf /etc
        fi
        if [ ! -f /etc/udhcpd.statics ]; then
                sudo /bin/cp /mnt/tcz/dhcp/udhcpd.statics /etc
        fi
        sudo mkdir -p /var/lib/misc
        sudo /usr/sbin/udhcpd -f /etc/udhcpd.conf > /var/log/udhcpd.log 2>&1 &


TFPTD:
        mkdir -p /opt/tftp
        sudo udpsvd -vE 0.0.0.0 69 tftpd /opt/tftp > /var/log/tftpd.log 2>&1 &

Tiny Core Linux File System: NTFS, NFS, CIFS/Samba


ntfs-3g
ntfs-3g-adv
ntfsprogs

NFS:
nfs-utils:
sudo ln -s /usr/local/etc/init.d/nfs-client /sbin
sudo nfs-client start

NFSD:
        if [ ! -f /etc/hosts.allow ]; then
                sudo /bin/cp /mnt/tcz/nfs/hosts.allow /etc
        fi

        if [ ! -f /etc/hosts.deny ]; then
                sudo /bin/cp /mnt/tcz/nfs/hosts.deny /etc
        fi

        if [ ! -f /etc/exports ]; then
                sudo /bin/cp /mnt/tcz/nfs/exports /etc
        fi

        st2 filesystems-KERNEL
        st2 nfs-utils

        sudo /bin/cp /mnt/tcz/nfs/nfs-server /usr/local/etc/init.d
        sudo ln -s /usr/local/etc/init.d/nfs-server /sbin

        mkdir -p /opt/nfs
        sudo nfs-server start

CIFS (Windows Share Folder):
cifs-utils
sudo mount.cifs -o username=xxx,password=xxx,sec=ntlm //ip/path /path

Samba (Windows Share Folder Service):
        SAMBA_HOME=/usr/local/etc/samba

        sudo mkdir -p $SAMBA_HOME

        if [ ! -f $SAMBA_HOME/smbpasswd ]; then
                sudo /bin/cp /mnt/tcz/cifs/smbpasswd $SAMBA_HOME
        fi

        if [ ! -f $SAMBA_HOME/smbusers ]; then
                sudo /bin/cp /mnt/tcz/cifs/smbusers $SAMBA_HOME
        fi

        if [ ! -f $SAMBA_HOME/smb.conf ]; then
                sudo /bin/cp /mnt/tcz/cifs/smb.conf $SAMBA_HOME
        fi

        st2 samba3

        sudo smbpasswd -a tc

        sudo ln -s /usr/local/etc/init.d/samba /sbin

        mkdir -p /opt/cifs

        sudo samba start

Tiny Core Linux XWindow


xf86-video-xxx
sudo Xorg -configure
edit xorg.conf
Section "ServerLayout"
   #Multi Screen
   Option         "Xinerama" "true"

lspci   (pci-utils.tcz)


xrandr -s 1280x1024

xrandr --output LVDS1 --mode 1024x600 --pos 0x0 --rotate normal --output VGA1 --off

and back again with:

xrandr --output LVDS1 --off --output VGA1 --mode 1280x1024 --pos 0x0 --rotate normal

0 - 15
/sys/class/backlight/acpi_video0/brightness
xbacklight


xset s off
xset -dpms

mouse speed x2
xset m 2 0

synclient TapButton1=1
synclient TapButton2=2 (mid: 2 finger)
synclient TouchpadOff=1

terminal title
echo -ne "\033]0;TITLE HERE\007"
echo -ne "\033]0;Hello World\007"

color red
\033[1;31m RED \033[0m

Tiny Core Linux WineHQ


./configure --enable-win64

prelink
libX11-dev
freetype-dev
gettext-dev
libXrender-dev
libxml2-dev
libxslt-dev
libjpeg-turbo-dev
libpng-dev
alsa-dev
gnutls-dev
xorg-proto
libXxf86vm-dev

Linux USB


lsusb


Can't find USB:

echo -1 | sudo tee /sys/module/usbcore/parameters/autosuspend
  --OR--
echo Y | sudo tee /sys/module/usbcore/parameters/old_scheme_first


Remove:
echo 1>/sys/bus/usb/devices/usb1/remove
hdparm --command=stop /dev/sda1
hdparm -Y /dev/sda1

Linux Shell Script Color Code / Bell


Script Color /bell
MSG="\033[031mBye\033[030m"
printf "\007"


Color Foreground Background
Black 30 40
Red 31 41
Green 32 42
Yellow 33 43
Blue 34 44
Magenta 35 45
Cyan 36 46
White 37 47

Linux sync time


NTP:
ntpclient -h time.smg.gov.mo -s

rdate:
rdate 192.168.1.1

System -> Hardware
hwclock -w

Hardware -> System
hwclock -s

Tiny Core Linux SSHD

openssh

cd /usr/local/etc/ssh

sudo mkdir -p bak
sudo /bin/mv ssh_host_* bak
sudo touch sshd_config
sudo ssh-keygen -A
sudo /usr/local/sbin/sshd