Search This Blog

Friday, August 8, 2014

Swap usage by PID


#> for i in `find /proc -maxdepth 1 -type d|xargs -i basename {}`; do echo -n "PID: $i SWAP: "; cat /proc/$i/smaps|fgrep Swap|awk '{s=s+$2}END{print s}'; done|sort -k4n

WINE + winetricks + WoT + Steam

Small note about installation and configuration process

#> WINEARCH=win32 winecfg

#> wget http://winetricks.org/winetricks
#> chmod +x winetricks
#> sudo cp winetricks /usr/local/bin

#> cd .wine/drive_c/
#> winetricks  d3dx9_36 vcrun2008 corefonts wininet msls31
#> winetricks  msxml3
#> winetricks  ie8

#> wine  WoT_internet_install_ru.exe
#> winecfg
Libraries:  Add: msvcp110 (native, buildin), msvcr110 (native, buildin)

#> wine msiexec /i SteamInstall.msi
#> wine Steam/Steam.exe -no-dwrite

Wednesday, August 6, 2014

SQLite...


Client configuration - rc file for sqlite3
~/.sqliterc
.headers ON
.timer ON



Create table with autoincrement primary key - id

CREATE TABLE table_name (id INTEGER PRIMARY KEY AUTOINCREMENT);


Order of field option important, don't swap it.

Friday, August 1, 2014

Xorg - adding undetected resolutions


Due to buggy hardware or drivers, your monitor's correct resolutions may not always be detected. For example, the EDID data block queried from your monitor may be incorrect.
If the mode already exists, but just isn't associated for the particular output, you can add it like this:
  • $ xrandr --addmode S-video 800x600
If the mode doesn't yet exist, you'll need to create it first by specifying a modeline:
  • $ xrandr --newmode <Mode``Line>
You may create a modeline using the gtf or cvt utility. For example, if you want to add a mode with resolution 800x600 at 60 Hz, you can enter the following command: (The output is shown following.)
  • $ cvt 800 600 60
    # 800x600 59.86 Hz (CVT 0.48M3) hsync: 37.35 kHz; pclk: 38.25 MHz
    Modeline "800x600_60.00"   38.25  800 832 912 1024  600 603 607 624 -hsync +vsync
Then copy the information after the word "Modeline" into the xrandr command:

$ xrandr --newmode "800x600_60.00"   38.25  800 832 912 1024  600 603 607 624 -hsync +vsync

Tuesday, July 29, 2014

X tuning

Some useful software for low level tuning X

xprop - WM classes and etc
xwininfo - window id*, position, style, owner and etc

 * xkill -id window_id_from_xwininfo

Friday, July 11, 2014

quote

You say you love rain, but you use an umbrella to walk under it.
You say you love sun, but you seek shelter when it is shining.
You say you love wind, but when it comes, you close your window.
So that's why I'm scared when you say you love me.


Bob Marley

Tuesday, June 10, 2014

small notes about django and etc


Just to remember, how to get project bse directory in django projects: 

settings.py
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
print(BASE_DIR)



# How to tell django ignore requests like /favicon.ico and etc.

settings.py

import re
IGNORABLE_404_URLS = (
    re.compile(r'^/favicon\.ico$'),
    re.compile(r'^/robots\.txt$'),
)



# How to serve static files in dev

settings.py

import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

STATIC_URL = '/s/'
STATIC_ROOT = ''
STATICFILES_DIRS = (
    os.path.join(BASE_DIR, 'static'),  # <- only one static files directory
)



Some magic in widget configuration

widget = forms.Select(attrs = {'onchange': 'this.form.submit();'})



pip freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs pip install -U