hazard
Clients | Linux and Photography Blog Skip to main content

Linux and Photography Blog

  • Contact Form
  • Privacy Policy

Tag: Clients

get all the urls in html file (local or on server).

February 17, 2014February 2, 2014 Amit Agarwal Leave a comment

To use this, you will need the lynx tool, so install that first.

sudo yum install lynx

Now, to get list of all the URLs in local html file or some URL, just execute this:

lynx -dump -listonly
Related articles
  • Trouble in using file_get_contents()
  • How to send image to server with url in ios
  • Endangered species of the Web: the Link

 

Enhanced by Zemanta
Link to this post!

Socialize

cgroups – use to control your cpu and memory

January 6, 2014January 5, 2014 Amit Agarwal Leave a comment

cgroups is a kernel feature and with userspace utilities, we can use the feature to control the cpu and memory for per process. So, lets first install the required tools.

sudo yum install libcgroup-tools

Now, we need to enable the service.

sudo systemctl enable cgconfig.service
sudo systemctl enable cgred.service

cgconfig.service is to enable configuration for cgroups and
cgred.service is to enable configuration for cgroups for processes depending on the name.

Now, we will need to configure the cgroups and configure the groups for the processes. So, lets open up the configuration files and do some configuration:

Here we will use firefox as the group name and use firefox as an example to restrict the memory to 700Mb and cpu to 10%. Since we do not have any other group configured right now, so max being 1024 – 100 shares would be around 10%.

First, open up the /etc/cgconfig.conf file and add the following. You would need to replace below with your username.

group firefox {
perm {
task {
uid = ;
gid = ;
}
admin {
uid = ;
gid = ;
}
}

cpu{
cpu.shares=”102″;
}
cpuset{
cpuset.cpus=0;
cpuset.mems=0;
}
memory {
memory.limit_in_bytes=”700M”;
memory.max_usage_in_bytes=”0″;
}
}

Now, we edit the /etc/cgrules.conf file and add the following:

:sandbox cpu,memory firefox
::firefox cpu,memory firefox

All done. Now, time to test.

First restart the services.

sudo systemctl restart cgconfig.service
sudo systemctl restart cgred.service

Check, if the cgroup is created. Go to directory:

/sys/fs/cgroup/memory or /sys/fs/cgroup/cpu

and check directory firefox exists.

Note: You can check the cgroup mount directory with mount command to see where your cgroups are mounted.

Now, start firefox, check the pid and check the file /proc//cgroup and you should see something like this:

11:hugetlb:/
10:perf_event:/
9:blkio:/
8:net_cls:/
7:freezer:/
6:devices:/
5:memory:/firefox
4:cpuacct,cpu:/firefox
3:cpuset:/
2:name=systemd:/user.slice/user-1000.slice/session-1.scope

and this is it.

Related articles
  • Using cgroups to limit something’s RAM consumption (a practical guide)
  • Cgroups
  • Oracle Linux containers continued
Enhanced by Zemanta
Link to this post!

Socialize

procmail filters – apply to received mails.

May 24, 2013May 5, 2013 Amit Agarwal Leave a comment

If you already have some mail in your maildir and you have set procmail filters, then it is difficult to apply the procmail filter, right? Not so, you just need to go to the Inbox directory and then execute the command.

for i in *; do cat $i|procmail; rm -f "$i"; done

This will pass all of your e-mail through procmail again and then your filters will get applied. Mails will go to their appropriate directory and you will be one happy man, I hope.

Related articles
  • Howto: Sort spam mails to the junk folder in Zarafa
  • Modern console mail clients?
  • Marcin Juszkiewicz: Automatic sorting of mailing lists with maildrop

 

Enhanced by Zemanta
Link to this post!

Socialize

Posts navigation

1 2 … 10 Older posts

Search

Pages

  • Contact Form
  • Privacy Policy
  • Sitemap

Blog

  • Android App
  • Contact Me
  • G+ Profile
  • Homepage
  • Login
  • My Photo Gallery
  • My Photos
  • RSS Feed

Cal

December 2019
M T W T F S S
« Oct    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Email Subscribe

Myself

raj77in

raj77in

Linux and Photography is my passion. Blog: http://blog.amit-agarwal.co.in

Personal Links

  • Linux Blog
  • Linux and Photography Blog
  • Docker Hub
  • Github

Verified Services

View Full Profile →

sparkling Theme by Colorlib Powered by WordPress