thinkpad x230 i7 fan noise with Ubuntu 16.04-2

My thinkfan.conf is working but it still makes a lot of noise (and with Ubuntu 14 and Debian 8 it didn’t)

root@x230:/home/iker# cat /etc/thinkfan.conf

hwmon /sys/devices/virtual/hwmon/hwmon0/temp1_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp3_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp1_input
hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon1/temp2_input

(0, 0,  53)
(1, 53, 66)
(2, 64, 68)
(3, 66, 70)
(4, 68, 73)
(5, 71, 76)
(7, 74, 32767)

mushroom risotto

Ingredients for 2 people:

two small onions or one big onion
two hundred grams of mushrooms
180 gram of rice
two cloves of garlic
extra virgin olive oil
butter 10 grams
black pepper
parmesan cheese (optional)

1) cut onions in small pieces
2) put the onions in a pan and a little bit of watter on number 7/10 for 5 minutes.
check that they don’t burn.
3) Boil some water in the kettle
4) cut the mushrooms and the garlic
5) put the rice with the onions and add some water. mix every couple of minutes.
when the water is finished add more water
6) put the mushrooms and the garlic in a pan
7) mix every minute
8) grate the parmesan cheese
9) When the rice is ready [about 10 minutes] add pepper and parmesan cheese. mushrooms and a  bit of water.

snmpd

I am doing some things with snmp and I will use this post as a pastebin.

pseudo switch

# apt-get install snmpd
# vim  /etc/snmp/snmpd.conf
agentAddress  udp:161
rocommunity   public 192.168.0.0/16

to use snmpwalk on another machine, in my case nagios:
# apt-get install snmp
$ snmpwalk -v 2c -c public 192.168.1.90

Nagios:

Usually nagios uses the NRPE client but for snmp it is not used.

root@nagios:/etc/nagios3/conf.d# vim services.cfg

define service {
name                                         switch_uptime
use                                             generic-service
service_description             switch_uptime
check_command                   snmp_UpTime!-C public
#   hostgroup_name                 all
host_name                             unswitch
}

define command{
command_name    snmp_UpTime
command_line    $USER1$/check_snmp -o 1.3.6.1.2.1.1.3.0 -H $HOSTADDRESS$ $ARG1$
}

# iso. = 1.

root@nagios:/etc/nagios3/conf.d# vim hosts.cfg

define host {
use                        generic-host
host_name        unswitch
address                192.168.1.90
}

root@tt01:/etc/nagios3/conf.d# vim hostgroups.cfg

define hostgroup {
hostgroup_name     all
members                   unserver,unswitch

}

Test via command line without using the web server:

root@nagios:/etc/nagios3/conf.d# /usr/lib/nagios/plugins/check_snmp 192.168.1.90 -o 1.3.6.1.2.1.1.3.0 -C public

ref:

http://blog.itlinux.cl/blog/2014/10/15/monitoreo-con-nagios-usando-snmp/

 

 

differences between for and while in C

They’re not equivalent. They differ in the use of continue;

If you use continue inside a while it does not increment “i” but if you use it inside a for loop it does increment “i” before going to the next cycle.

Example:


#include <stdio.h>
int main(){

int i=0,a=b=2;

 for(i=0;i!=3;i++){
     printf("%d ",i);
     if (a==b) continue;
     printf("never here");
 }
i=0;
 While (i!=3){ // infinite loop
    printf("%d ",i);
    if (a==b) continue;
    printf("never here");
 }

}

senselock under linux


iker@L450:/etc/udev/rules.d$ dmesg|tail

[ 3991.672990] usb 1-1: new low-speed USB device number 20 using xhci_hcd
[ 3991.864469] usb 1-1: New USB device found, idVendor=0471, idProduct=485e
[ 3991.864472] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 3991.864474] usb 1-1: Product: Elite4 2.x
[ 3991.864475] usb 1-1: Manufacturer: Senselock
[ 3991.864610] usb 1-1: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3991.905815] hid-generic 0003:0471:485E.0010: hiddev0,hidraw0: USB HID v1.10 Device [Senselock Elite4 2.x] on usb-0000:00:14.0-1/input0


but hiddev0 needs to have propper permissions.


iker@L450:/etc/udev/rules.d$ cat /etc/group|grep plugdev

plugdev:x:46:iker

iker@L450:/etc/udev/rules.d$ cat 99-senselock.rules

KERNEL=="hiddev*", ATTRS{idVendor}=="0471", MODE="0660", GROUP="plugdev"

iker@L450:/etc/udev/rules.d$ sudo udevadm trigger

PD: I don't like senselock and it is not secure, just annoying. I was asked to use it. Since the device can no longer use new versions of Keil people are using only 8052AH simple mode and the advanced functions senselock once had are unusable so the security it provides actually is silly. I DO NOT recommend Senselock.

Arduino nano and CJMCU board, 1 side PCB

Using only 1 side PCB, no wires and requiring minimum space.

Quadrature encoder pins go to Arduino Nano’s interrupt pins.

Digital side RST, A07, A04, A03 and A02 are not connected.

CJMCU motor board is the tipical ST VNH2SP30 chinese board (I’ve more posts about it)

I’ve put it vertically.

Nano_PinOut

 

Snort in Debian 8 Jessie

DEbian Jessie doesn’t have a package for Snort so I’ve at least two options, compile from source and take it from testing. I don’t want to have broken packages so I won’t add testing to my sources list directly and I will only use it for specific packages, in this case snort.
It works and nothing is broken.

vim /etc/apt/apt.conf.d/99defaultrelease:


  APT::Default-Release "stable";

vim /etc/apt/sources.list.d/stable.list


  deb     http://ftp.de.debian.org/debian/    stable main contrib non-free
  deb-src http://ftp.de.debian.org/debian/    stable main contrib non-free

  deb     http://security.debian.org/         stable/updates  main contrib non-free

vim /etc/apt/sources.list.d/testing.list


  deb     http://ftp.de.debian.org/debian/    testing main contrib non-free
  deb-src http://ftp.de.debian.org/debian/    testing main contrib non-free

  deb     http://security.debian.org/         testing/updates  main contrib non-free

apt-get update

apt-cache -t testing search snort

  ...
  snort - flexible Network Intrusion Detection System
  snort-common - flexible Network Intrusion Detection System - common files
  snort-common-libraries - flexible Network Intrusion Detection System - libraries
  snort-doc - flexible Network Intrusion Detection System - documentation
  snort-rules-default - flexible Network Intrusion Detection System - ruleset
  ...

apt-get -t testing install snort

Source:
http://serverfault.com/questions/22414/how-can-i-run-debian-stable-but-install-some-packages-from-testing

Now my Ansible code


- hosts: 
    somehost
  gather_facts: yes

  tasks:

  - name: Copy defaultrelease for apt
    copy: 
      src: files/99defaultrelease
      dest: "/etc/apt/apt.conf.d/99defaultrelease"

  - file: dest=/etc/apt/sources.list.d/ state=directory

  - name: Copy stable and testing sources
    copy: 
      src: "files/{{ item }}"
      dest: "/etc/apt/sources.list.d/"
    with_items:
      - stable.list
      - testing.list

  - name: Update apt cache if needed.
    apt: update_cache=yes

  - name: Install Snort
    apt: 
      name={{ item }} 
      state=present 
      default_release=testing
    with_items:
      - snort
      - snort-common
      - snort-rules-default