Category Archives: IT

Ulimit mac file handle

Ulimit

/etc/security/limits.conf
* soft nofile 65535
* hard nofile 65535
/etc/pam.d/common-session*
session required pam_limits.so

verify
# su – oracle
$ ulimit -Hn
$ ulimit -Sn

# vi /etc/sysctl.conf

Append a config directive as follows:
fs.file-max = 500000

# sysctl -p

Enable developer mode: Nexus 6p

Open the Settings app.
Scroll down to the bottom and select About phone.
Scroll to the bottom and press Build number 7 times (you’ll see a confirmation that you are now a developer), press the back button.
Developer options will now appear at the bottom of Settings, select it.

PPTP VPN VPS Ubuntu 16

apt-get install pptpd

Modify /etc/pptpd.conf find ‘localip’ and ‘remoteip’ and replace with


localip 10.0.0.1
remoteip 10.0.0.50-100

After add the ip scope, we can continue adding users VPN with modifying /etc/ppp/chap-secrets, for example


max pptpd 123456 *

modify /etc/ppp/options,


ms-dns 8.8.8.8
ms-dns 8.8.4.4

/etc/sysctl.conf,


 net.ipv4.ip_forward=1

Run following, Pay attention to eth0, it may need change to right interface name


$ sudo sysctl -p

$ sudo /etc/init.d/pptpd restart

$ sudo /sbin/iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE


cat > /etc/init.d/pptpenable
/sbin/iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE

CTRL+D

$ chmod +x vpnrule
$ update-rc.d vpnrule defaults


/etc/default/ufw

DEFAULT_FORWARD_POLICY="ACCEPT"

/etc/ufw/before.rules add below rules. and then restart ufw

# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]

# Forward traffic through eth0 - Change to match you out-interface
-A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE

# don't delete the 'COMMIT' line or these nat table rules won't
# be processed
COMMIT

#adding this rule to the file /etc/ufw/before.rules before the line # drop INVALID packets ...

-A ufw-before-input -p 47 -j ACCEPT

#Then Run
 sudo ufw disable && sudo ufw enable

Android: make TextView looks exactly like EditText

android:background=”?attr/editTextBackground”


  <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Your text"
            android:hint="My hint"
            android:textColor="?attr/editTextColor"
            android:background="?attr/editTextBackground"
            android:gravity="center_vertical"
            android:textAppearance="?android:attr/textAppearanceMediumInverse"
            />

Math homework self service for kids, grade 3 review . 250 checks.


#!/usr/local/bin/perl

$totalcount=0;
$mistake=0;
$total=250;
while($totalcount<$total)
{
$no1=int(rand(time))%30;
$no2=int(rand(time))%30;

if($no1==0) 
{
$no1++;
}

if($no2==0) 
{
$no2++;
}
$plus=int(rand(time))%2;
$answer=0;
$wronglook=0;
GETINPUT:

if($plus==0)
{

$answer=$no1 + $no2;

print "$no1 + $no2 =";
if($no1>$no2)
{
$wronglook=$no1 - $no2;
}
else
{
$wronglook=$no2 - $no1;
}
}
else
{
$wronglook=$no1 + $no2;
if($no1>$no2)
{

print "$no1 - $no2 =";
$answer=$no1 - $no2;

}
else
{
print "$no2 - $no1 =";
$answer=$no2- $no1;
}
}



$userinput =  <STDIN>;
chomp($userinput);
if(length($userinput)==0)
{
print "Please input your answer\n";
goto GETINPUT;
}
$totalcount++;;

if($userinput == $answer) 
{
print "Great!!!! you did good job , the answer is Correct $userinput\n";
}
elsif($wronglook==$userinput)
{
print "Almost there!Let's take a second look at Operation sign is it + or -\n";
goto GETINPUT;

}
else
{
$mistake++;
print "wrong, the correct answer is ".$answer."\n";
}
if($totalcount%10==0)
{
$score=int(100-$mistake*100/$totalcount);
$left=$total-$totalcount;
$leftpercent=int($totalcount*100/400);
print "$totalcount problems done, ".$left." to go. finishing ".$leftpercent."\%. Score correct percentage rate ".$score."\%\n"; 
}

}