Tuesday, August 8, 2017

configure mozc

to configure mozc (e.g. to add emoji conversion dictionary) run

/usr/lib/mozc/mozc_tool --mode=config_dialog

Thursday, May 25, 2017

mount image file

sudo modprobe loop

sudo losetup -f
this returns a new loop device (e.g. /dev/loop4) which can be associated to the image

sudo losetup /dev/loop4 image.img

sudo partprobe /dev/loop4
creates the devices /dev/loop4p1 etc. (for each partition)

sudo mount /dev/loop4p1 /tmp/loop4/

Sunday, April 9, 2017

let's note no sound音なし ubuntu

alsamixer -c 1, raise headphone volume

Monday, March 20, 2017

eagle to wire

in inkscape :
File/ Inscape preferences / SVG output / diable "Allow relative coordinates"
sudo pip3 install svg.path
use https://github.com/fabiodl/eagleUlp/blob/master/svgToWire.py

Monday, March 13, 2017

grub hotkey

grub entries are generated by the scripts in /etc/grub.d/ and collected as /boot/grub/grub.cfg
the overall configuration is in /etc/default/grub
you can edit the script /etc/default/grub/40_custom
by copying entries from  /boot/grub/grub.cfg
to add an hotkey,

menuentry ... --hotkey w {
...


sources:
https://linuxnorth.wordpress.com/2011/03/09/grub2-revisited/
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1178618


Thursday, March 2, 2017

eagle keybindings

to add a keybinding for changing wire bend
option-assign
and add new keybindings like
set wire_bend 1
set wire_bend 3

Friday, December 16, 2016

VU meter on foobar 2000

Install foobar2000
http://www.foobar2000.org/download

create a folder named "user-components" in
%APPDATA%\foobar2000

create a folder named "foo_vis_vumeter" in
%APPDATA%\foobar2000\user-componets

put the content of
https://drive.google.com/file/d/0B6yNdh9XmSWKX1lJQ0ZFOWdJTlU/edit
 inside %APPDATA%\foobar2000\user-componets\foo_vis_vumeter

for skins, download

http://orig12.deviantart.net/1d98/f/2016/220/6/5/denon_v6_analog_vu_meters_skin_by_noel62_by_noel62-dad3827.zip


Tuesday, October 18, 2016

include (input) file inside table

to include raw files inside a table define

\makeatletter
\newcommand\primitiveinput[1]
{\@@input #1 }
\makeatother

 and then use it as

  \primitiveinput{proben.tex}


source:
http://tex.stackexchange.com/questions/50694/cannot-use-toprule-when-doing-input-inside-tabular-why

Monday, October 3, 2016

template: detect required argument type of a function and adapt the data consequently

Example: classes' operator () can receive either a type G or a I<G>.
We pass either the argument I<G> or its member x of type G to operator () depending on what the operator is able to take

#include <iostream>

template <typename G> class I{
public:
  G x;
};


template<typename G>
class Caller{   
public:
  template<typename C>
  static void pass(C& c,I<G>& i){c(i.x);}

};

template<typename G>
class Caller<I<G> >{   
public:
  template<typename C>
  static void pass(C& c,I<G>& i){c(i);}
};


template<typename C,typename X>
X getArgumentType(void (C::*f)(X));

template<typename C,typename G>
inline void call(C& c,I<G>& i){
  Caller<typeof(getArgumentType(&C::operator()))>::pass(c,i);
}

 

struct A{
  void operator()(int x){
    std::cout<<"This is A "<<x<<std::endl;
  }
};

struct B{
  void operator()(I<int>& y){
    std::cout<<"This is B "<<y.x<<std::endl;
  }
};



int main(){

  A a;
  B b;
  I<int> y;
  y.x=77;
  call(a,y);
  call(b,y);
}

Wednesday, September 28, 2016

keyboard (language) icon missing

Keyboard icons missing in gnome-flashback


create a new theme
mkdir -p ~/.icons/addflags/status/22

create file ~/.icons/addflags/index.theme with the following content

[Icon Theme]
Name=addflags
Comment=Smooth modern theme designed to be intuitive.
Inherits=moblin

Example=directory-x-normal

#Directory list
Directories= status/22

[status/22]
Size=22
Context=Status
Type=Fixed

where Inherits is the theme you want to use

set the theme (e.g. by gnome-tweak-tool)  to addflags


status/22 contains the icons indicator-keyboard-*.svg
taken from example from
  usr/share/icons/ubuntu-mono-dark/status/22/
(sudo apt-get install ubuntu-mono)

Sunday, September 25, 2016

Windows password

To change the password policy (pwd length, pwd expiration period)
run secpol.msc
navigate to account policy / password policy

To unlock a locked out user
run lusrmgr.msc
double click the user
untick the lock


Wednesday, September 7, 2016

Thursday, July 21, 2016

Custom gnome session

Lightdm looks for

/usr/share/xsessions/cairo-dock-xmonad.desktop

[Desktop Entry]
Name=Cairo-Dock-Xmonad (GNOME)
Comment=This session logs you into GNOME with Cairo-Dock and Xmonad
Exec=gnome-session --session=cairo-dock-xmonad
TryExec=cairo-dock-session
Icon=
Type=Application

The session required components are given in
/usr/share/gnome-session/sessions/cairo-dock-xmonad.session

[GNOME Session]
Name=Cairo-Dock-Xmonad
RequiredComponents=gnome-settings-daemon;xmonad-xcomp;cairo-dock;
DesktopName=Unity

the component is defined in
/usr/share/applications/xmonad-xcomp.desktop

[Desktop Entry]
Type=Application
Name=Xmonad-Xcomp
Exec=xm
NoDisplay=true
X-GNOME-WMName=Xmonad
X-GNOME-Autostart-Phase=WindowManager
X-GNOME-Provides=windowmanager
X-GNOME-Autostart-Notify=true

Wednesday, July 20, 2016

Remove a package installed from a ppa


to list the ppa the package comes from:

apt-cache policy packagename
e.g.
apt-cache policy cairo-dock

the output is something like
http://ppa.launchpad.net/cairo-dock-team/ppa/ubuntu/ trusty/main amd64 Packages

to downgrade  it
sudo -E ppa-purge ppa:cairo-dock-team/ppa

sources:
http://askubuntu.com/questions/32835/whats-the-name-of-ppa-for-ppa-purge
http://askubuntu.com/questions/307/how-can-ppas-be-removed

super p stolen from xmonad

If <Super>P is associated with xrandr (stealing the keybinding from xmonad):

dconf-editor

disable

org/ gnome / settings-daemon / plugins / media-keys / active

source:
http://askubuntu.com/questions/68463/how-to-disable-global-super-p-shortcut

Tuesday, July 19, 2016

nautilus specify samba's domain name

 smb://WORKGROUP;User@machine.somewhere.com/Share

source:
http://hints.macworld.com/article.php?story=20031203172256827

gnome panel crashing with transparent background

Fix libcairo

--Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91967
Signed-off-by: Uli Schlachter <psychon@znc.in>
----
 src/cairo-xlib-surface.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 3f407c3..555c1fe 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -807,6 +807,7 @@ _get_image_surface (cairo_xlib_surface_t    *surface,
         }

         cairo_surface_destroy (&image->base);
+        image = NULL;
     }
     }

@@ -1011,7 +1012,8 @@ _get_image_surface (cairo_xlib_surface_t    *surface,
     cairo_device_release (&display->base);

     if (unlikely (status)) {
-    cairo_surface_destroy (&image->base);
+    if (image)
+        cairo_surface_destroy (&image->base);
     return _cairo_surface_create_in_error (status);
     }

--


source:
https://bugs.freedesktop.org/show_bug.cgi?id=91967

Wednesday, July 6, 2016

avconv misc

create  video from images

   avconv -r 20 -i in/%05d.png out.avi

to set codec
 -vcoded _codecname_

e.g. (for windows)
 -vcodec msmpeg4v2

to crop (width:height:x:y)
 -vf crop=128:128:20:20

to resize with nearest neighbor:

 avconv -i in.avi -vf scale=512:512:flags=neighbor out.avi

Thursday, June 16, 2016

transparency of emacs in xmonad

To enable transparency run

xcompmgr -c &


 and in emacs


(set-frame-parameter (selected-frame) 'alpha '(85 . 50))
 (add-to-list 'default-frame-alist '(alpha . (85 . 50)))

sources:

https://www.emacswiki.org/emacs/TransparentEmacs

https://wiki.haskell.org/Xmonad/Frequently_asked_questions#How_do_I_use_compositing_with_xmonad.3F

Wednesday, June 15, 2016

Plymouth and lightdm

If plymouth does not show (purple screen) after nvidia drivers install


In /etc/default/grub
set
GRUB_GFXPAYLOAD_LINUX="keep"


And in /etc/initramfs-tools/conf.d/splash

set

FRAMEBUFFER=y

If you want to check the video resolution, vbeinfo does not work anymore, use

videoinfo


at the GRUB terminal (loaded by pressing C)


To changhe plymouth theme from GUI:

  plymouth-manager

 https://launchpad.net/plymouth-manager


To enable the automatic background for lightdm

dconf  
and set org.gnome.settings-daemon.plugins.background to active


sources:


http://onetransistor.blogspot.jp/2016/03/plymouth-fix-nvidia.html
http://askubuntu.com/questions/577486/how-do-i-run-vbeinfo

http://askubuntu.com/questions/449677/how-do-i-set-the-lightdm-wallpaper-in-ubuntu-14-04

Thursday, June 2, 2016

xmonad master area on the right

to have the master area on the right,

import XMonad.Layout.Reflect 

add in the xmonad hooks replacement section add

 , layoutHook = smartBorders (reflectHoriz $ layoutHook gnomeConfig)


as in 


main = do
    dbus <- D.connectSession
    getWellKnownName dbus
    xmonad $ gnomeConfig
         { logHook = dynamicLogWithPP (prettyPrinter dbus)
 , mouseBindings = myMouseBindings 
 , layoutHook = smartBorders (reflectHoriz $ layoutHook gnomeConfig)
 , normalBorderColor   =  "#808080"
         , focusedBorderColor =  "#00ecec"
         ,  modMask = mod4Mask -- set the mod key to the windows key
 , startupHook = setWMName "LG3D"
         } `additionalKeys` myKeys

sources:
http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Layout-Reflect.html
https://donsbot.wordpress.com/2010/03/13/after-3-years-my-xmonad-configuration-now-uses-gnome/

Example of numpy and c integration by ctype

example.c

#include <sys/types.h>

//sum by rows only the elements less than th
void sumLowerThan(double* res, double *a, ssize_t* dims,double th)
{
  int i,j;double v;
  for (i=0; i<dims[0]; i++) {
    res[i]=0;
    for (j=0;j<dims[1];j++){
      v=a[i*dims[1]+j];
      if (v<th){
        res[i]+=v;
      }     
    }//for j   
  }
}

compile with

gcc -shared -Wl,-soname,example -o example.so -fPIC example.c

example.py

#!/usr/bin/env python
import ctypes
import numpy as np


lib = np.ctypeslib.load_library('example', '.')

lib.sumLowerThan.restype = None
lib.sumLowerThan.argtypes = [np.ctypeslib.ndpointer(float, ndim=1,  # res
                                                    flags='aligned, contiguous, writeable'),
                             np.ctypeslib.ndpointer(float, ndim=2,  # a
                                                    flags='aligned, contiguous'),
                             ctypes.POINTER(np.ctypeslib.c_intp),  # dims
                             ctypes.c_double,  # th
                             ]


def sumLowerThan(a, th):
    a = np.require(a, float, ['CONTIGUOUS', 'ALIGNED'])
    res = np.require(np.empty(np.size(a, 0)),
                     float, ['CONTIGUOUS', 'ALIGNED', 'WRITEABLE'])
    lib.sumLowerThan(res, a, a.ctypes.shape, th)
    return res


a = np.random.rand(5, 10)
print(a)
print(sumLowerThan(a, 0.5))


sources:
http://stackoverflow.com/questions/5081875/ctypes-beginner
http://docs.scipy.org/doc/numpy-1.10.1/user/c-info.python-as-glue.html






minimal pyqtgraph multithreading plotting example

#!/usr/bin/env python
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import Queue
from threading import Thread


class QtPlotter:

    def __init__(self):
        self.ports = []
        self.timer = pg.QtCore.QTimer()
        self.win = pg.GraphicsWindow()
        self.ax = self.win.addPlot()
        self.timer.timeout.connect(self.update)
        self.timer.start(0)
        self.ax.setAspectLocked(True)

    def getPort(self):
        q = Queue.Queue()
        plt = self.ax.plot()

        self.ports.append((q, plt))
        return q

    def update(self):
        for q, plt in self.ports:
            try:
                    data, color = q.get(block=False)
                    plt.clear()
                    plt.setData(
                        np.asarray(data[0, :]).flatten(),
                        np.asarray(data[1, :]).flatten(), pen=None, symbol="o",
                        symbolPen=pg.mkPen({'color': color, 'width': 2}),
                        symbolSize=1
                    )

            except Queue.Empty:
                pass


def qtLoop():
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()


def example():
    import time
    plotter = QtPlotter()
    curve = plotter.getPort()

    def producer():
        while True:
            curve. put((np.random.random(size=(2, 10)), "#00FFFF"))
            time.sleep(1)

    p = Thread(target=producer)
    p.daemon = True
    p.start()

    qtLoop()

if __name__ == "__main__":
    example()

Monday, May 16, 2016

cygwin change locale

right click, options, text and set the locale

source: https://cygwin.com/cygwin-ug-net/setup-locale.html

Thursday, May 12, 2016

auto complete for ein

if
(setq ein:use-auto-complete t)

gives the error
symbol's function definition is void: ac-define-source

then install auto-complete in emacs
(it comes automatically if you install ac-anaconda)


M-x elpy- config tells what is not installed
install it with pip

source:
https://realpython.com/blog/python/emacs-the-best-python-editor/

Sunday, May 1, 2016

joystick to keyboard emulation

you can use antimicro

for Ubuntu 14.04, 15.04 and 15.10

sudo add-apt-repository ppa:ryochan7/antimicro
sudo apt-get update
sudo apt-get install antimicro

for Ubuntu 16.04

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install antimicro


It can be used for playing showel knight


source:
http://www.webupd8.org/2014/09/gamepad-keyboardmouse-mapping-app.html

Sunday, April 24, 2016

jupyter notebook

To have vectorial images
from IPython.display import set_matplotlib_formats
set_matplotlib_formats('png', 'pdf')

source: http://blog.rtwilson.com/how-to-get-nice-vector-graphics-in-your-exported-pdf-ipython-notebooks/

to have inline images

%matplotlib inline
import matplotlib
matplotlib.rcParams["figure.facecolor"]=(1,1,1,1)
matplotlib.rcParams["axes.facecolor"]=(1,1,1,1)

Friday, April 22, 2016

ein ipython notebook

ein does not work when the system variables http_proxy and https_proxy are set.

ein:notebooklist-open

gives the error

REQUEST [error] Error (error) while connecting to http://127.0.0.1:8888/api/contents.
REQUEST [error] Callback is not called when stopping process! Explicitly calling from timer.
ein: [error] Content list call http://127.0.0.1:8888/api/contents/ failed with status timeout.

remove the variables and set the proxies manually.

For ELPA:
(setq url-proxy-services '(("no_proxy" . "127.0.0.1")
                           ("http" . "myproxy.com:8080")))

For erc:
(setq socks-noproxy '("localhost"))
(require 'socks)
(setq erc-server-connect-function 'socks-open-network-stream)
(setq socks-server (list "proxyIdentifier" "myproxy.com" 8080 5))

where 5 is the SOCKS version (can be 4)

to have inline images in emacs, libraries for the images are required, otherwise the following error is reported

Error (websocket): in callback `on-message': error: "Not an image: nil"

in windows
copy bin/libpng16-16.dll and bin/zlib1.dll of
https://sourceforge.net/projects/ezwinports/files/libpng-1.6.12-w32-bin.zip/download

to emacs's bin directory

To enable / disable transparent plots:

import matplotlib
matplotlib.rcParams["figure.facecolor"]=(1,1,1,x)
matplotlib.rcParams["axes.facecolor"]=(1,1,1,x)
where x is the alpha (0 for transparent, 1 for fully opaque)


sources:
 https://www.emacswiki.org/emacs/UrlPackage
https://www.emacswiki.org/emacs/ErcProxy
http://stackoverflow.com/questions/2650041/emacs-under-windows-and-png-files

Thursday, April 21, 2016

ipyhon

to autoreload in ipython type

%load_ext autoreload
%autoreload 2


to make it permanent

create a profile
ipython profile create
  
add in
~/.ipython/profile_default/ipython_config.py (win)
~/.config/ipython/profile_default/ipython_config.py (linux, old ipython)
 ~/.ipython/profile_default/ipython_config.py (linux, new ipython)


the following lines

c.InteractiveShellApp.exec_lines = []
c.InteractiveShellApp.exec_lines.append('%load_ext autoreload')
c.InteractiveShellApp.exec_lines.append('%autoreload 2')
c.InteractiveShellApp.exec_lines.append('print("autoreload active")')


source:
http://stackoverflow.com/questions/1907993/autoreload-of-modules-in-ipython/10472712#10472712

map tcp port to another

map port 1234 to be seen as 6667
socat TCP-LISTEN:1234,fork,reuseaddr TCP:localhost:6667

Sunday, November 1, 2015

sharing connection

To enable the IP forwarding

#!/bin/bash
# test if ip-forward is up - if not, enable it:
#
ipf=$(cat /proc/sys/net/ipv4/ip_forward)
if [[ ipf -eq "0" ]] ; then
    echo "1" > /proc/sys/net/ipv4/ip_forward
fi
#
# forward-masquerade
#
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
#
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
#
iptables -A FORWARD -p tcp --tcp-flags SYN,RST, SYN -j TCPMSS --clamp-mss-to-pmtu

#
service isc-dhcp-server restart


source:
http://unix.stackexchange.com/questions/16754/how-to-share-the-internet-connection

MTU

to change the MTU for a ppp of the network manager, edit /etc/NetworkManager/system-connections/connection_name at the section ppp

source:
http://ubuntuforums.org/showthread.php?t=1560232


Wednesday, October 21, 2015

vmware

when the kernel modules code need to be corrected, edit
/usr/lib/vmware/modules/source/vmnet.tar

source:
https://communities.vmware.com/message/2450503

Monday, October 19, 2015

clock in gnome-flashback

To enable date-time
dconf-editor (not gconf-editor) and navigate to
com.canonical.indicator

Tuesday, September 22, 2015

Vmware with physical partition under windows

if you get the error Operation on file "\\.\PhysicalDrive1" failed 
then you need to get the disk offline
from a prompt  launch diskpart
and then 
DISKPART > select disk 1
DISKPART > offline disk 


sources:
http://www.experts-exchange.com/Software/VMWare/Q_26689536.html
https://social.technet.microsoft.com/Forums/windowsserver/en-US/48ea44b0-9962-49e3-95a1-568275851753/take-a-hdd-offlineonline?forum=winserverpowershell

Tuesday, September 1, 2015

resize window from command line



use the following script:
source:
http://blog.yjl.im/2012/05/window-resizing-one-liner-using.html

#!/bin/bash
# Using xwininfo and wmctrl to resize a window
# Written by Yu-Jie Lin
# Public Domain

WIN_ID=$(xwininfo | egrep -om 1 '0x[0-9a-z]+')
W=$1
H=$2
X=${3:--1}
Y=${4:--1}

wmctrl -i -r $WIN_ID -e 0,$X,$Y,$W,$H

Saturday, August 22, 2015

custom live cd


 sudo apt-get install uck


dowload ubuntu mini remix
 http://www.ubuntu-mini-remix.org/



 sudo uck-remaster-unpack-iso Downloads/ubuntu-mini-remix-14.04.1-amd64.iso


sudo uck-remaster-unpack-rootfs
sudo uck-remaster-chroot-rootfs


add universe and multiverse to the /etc/apt/sources.list

deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse

[apt-get upgrade]

...customize by apt gets ...
you can use apt-get install --no-install-recommends emacs

remove unused kernels by
 dpkg --list | grep linux-image
 sudo apt-get purge <unused ones>




sudo uck-remaster-pack-rootfs
sudo uck-remaster-pack-iso test.iso


for changing the default thema change
 /usr/share/glib-2.0/schemas/org.gnome.desktop.interface.gschema.xml
then
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/


  /usr/share/glib-2.0/schemas/

sources:
 https://code.google.com/p/ardesia/wiki/Create_a_live_distro
https://lists.ubuntu.com/archives/foundations-bugs/2014-August/207632.html
 http://askubuntu.com/questions/65900/how-can-i-change-default-settings-for-new-users

Saturday, August 15, 2015

dark borders firefox

replace
/usr/share/themes/Adwaita/gtk-2.0/gtkrc
 
with this
 
 #Color scheme originally contributed by Franco Gotusso as Clearlooks-DarkOrange 
# Based on Clearlooks-DarkCoffee by Chibi and edited by bvc as Clearlooks-DarkCoffee2

style "clearlooks-default"
{
  GtkMenuItem::selected_shadow_type = none
  GtkWidget::interior_focus = 1
  GtkButton::default_border = { 3, 3, 3, 3 }
  GtkButton::default_outside_border = { 3, 3, 3, 3 }
  GtkRange::trough_border = 2

  GtkWidget::focus_padding = 1

  GtkPaned::handle_size = 6

  GtkRange::slider_width = 15
  GtkRange::stepper_size = 15
  GtkScrollbar::min_slider_length = 30
  GtkCheckButton::indicator_size = 12
  GtkMenuBar::internal-padding = 0

  GtkTreeView::expander_size = 14
  GtkExpander::expander_size = 16

  GtkTreeView::odd_row_color = "#404040"

  GtkWidget::cursor_color           = "#72706E"
  GtkWidget::secondary_cursor_color = "#72706E"

  xthickness = 1
  ythickness = 1

  fg[NORMAL]        = "#d2cfcc" #Main window text
  fg[PRELIGHT]      = "#E9E9E9" #Highlighted widget text
  fg[ACTIVE]        = "#ADA59D" #Inactive widget text
  fg[SELECTED]      = "#E9E9E9"
  fg[INSENSITIVE]   = "#A18989"

  bg[NORMAL]        = "#393f3f" #Backround
  bg[PRELIGHT]      = "#3465A4" #Highlight Widget
  bg[ACTIVE]        = "#2E3232" #Selected Widget
  bg[SELECTED]      = "#3465A4" #The box words are usually in
  bg[INSENSITIVE]   = "#282B2B" #Not active buttons
  base[NORMAL]      = "#4F524F" #Text area widgets
  base[PRELIGHT]    = "#313131" #Check and radio button background
  base[ACTIVE]      = "#313636" #Unfocused Select
  base[SELECTED]    = "#2F4C6D" #Selected Text area item, and that bar over the tabs.
  base[INSENSITIVE] = "#f5f2ee" #

  text[NORMAL]      = "#EEEEEC" #Text area widget text.
  text[PRELIGHT]    = "#E9E9E9" #
  text[ACTIVE]      = "#ADA59D" #
  text[SELECTED]    = "#E9E9E9" #Selected Text area widget text.
  text[INSENSITIVE] = "#757575" #

engine "clearlooks"
   {
    #    sunkenmenubar      = 1       # 0 = disable, 1 = enable
    #    menuitemstyle      = 1       # 0 = flat, 1 = 3d-ish (button)
    #    listviewitemstyle  = 1       # 0 = flat, 1 = 3d-ish (gradient)
    #    progressbarstyle   = 0       # 0 = candy bar, 1 = flat
  }
}

style "clearlooks-wide" = "clearlooks-default"
{
  xthickness = 2
  ythickness = 2
  bg[NORMAL]   = "#414141"
  bg[PRELIGHT] = "#494949"
}

style "clearlooks-button" = "clearlooks-wide"
{
  bg[NORMAL]   = "#414141"
  bg[PRELIGHT] = "#494949"
}

style "clearlooks-notebook" = "clearlooks-wide"
{
  bg[NORMAL] = "#404040"
  bg[ACTIVE] = "#303030"
}

style "clearlooks-tasklist" = "clearlooks-default"
{
  xthickness = 5
  ythickness = 3
}

style "clearlooks-menu" = "clearlooks-default"
{
  xthickness = 2
  ythickness = 1
  bg[NORMAL] = "#404040"
}

style "clearlooks-menu-item" = "clearlooks-default"
{
  xthickness = 2
  ythickness = 3
  fg[PRELIGHT]   = "#E9E9E9"
  text[PRELIGHT] = "#E9E9E9"
  base[PRELIGHT] = "#3465A4"
  base[SELECTED] = "#3465A4"
}

style "clearlooks-menu-itembar" = "clearlooks-default"
{
  xthickness = 3
  ythickness = 3
}

style "clearlooks-tree" = "clearlooks-default"
{
  xthickness = 2
  ythickness = 2
}

style "clearlooks-frame-title" = "clearlooks-default"
{
  fg[NORMAL] = "#e2dfdc"
}

style "clearlooks-panel" = "clearlooks-default"
{
  xthickness = 3
  ythickness = 3
}

style "clearlooks-tooltips" = "clearlooks-default"
{
  xthickness = 4
  ythickness = 4
  bg[NORMAL] = "#3465A4"
}

style "clearlooks-progressbar"  = "clearlooks-default"
{
  xthickness = 1
  ythickness = 1
   fg[PRELIGHT]         = "#e2dfdc"
   bg[NORMAL]           = "#2d1d11"
}

style "clearlooks-combo" = "clearlooks-default"
{
  xthickness = 1
  ythickness = 2
  fg[NORMAL]            = "#141414"
  fg[PRELIGHT]          = "#ed7013"
  fg[ACTIVE]            = "#e2dfdc"
  bg[NORMAL]            = "#414141"
  bg[PRELIGHT]          = "#494949"
}

style "clearlooks-scrollbar" = "clearlooks-default"
{
  fg[NORMAL]            = "#141414"
  fg[PRELIGHT]          = "#e2dfdc"
  fg[ACTIVE]            = "#e2dfdc"
  bg[NORMAL]            = "#414141"
  bg[PRELIGHT]          = "#494949"
}

style "clearlooks-spin" = "clearlooks-wide"
{
  fg[NORMAL]            = "#141414"
  fg[PRELIGHT]          = "#e2dfdc"
  fg[ACTIVE]            = "#e2dfdc"
  bg[PRELIGHT]          = "#414141"
  bg[ACTIVE]            = "#494949"
}

class "GtkWidget" style "clearlooks-default"
class "GtkRange" style "clearlooks-wide"
class "GtkFrame" style "clearlooks-wide"
class "GtkSpinButton" style "clearlooks-spin"
class "GtkStatusbar" style "clearlooks-wide"
class "GtkMenu" style "clearlooks-menu"
class "GtkMenuItem" style "clearlooks-menu-item"
widget_class "*MenuItem.*" style "clearlooks-menu-item"
class "GtkEntry" style "clearlooks-wide"
widget_class "*.tooltips.*.GtkToggleButton" style "clearlooks-tasklist"
widget_class "*.GtkTreeView.GtkButton" style "clearlooks-tree"
widget_class "*.GtkCTree.GtkButton" style "clearlooks-tree"
widget_class "*.GtkList.GtkButton" style "clearlooks-tree"
widget_class "*.GtkCList.GtkButton" style "clearlooks-tree"
widget_class "*.GtkFrame.GtkLabel" style "clearlooks-frame-title"
widget_class "BasePWidget.GtkEventBox.GtkTable.GtkFrame" style "clearlooks-panel"
widget "gtk-tooltips" style "clearlooks-tooltips"
class "GtkNotebook" style "clearlooks-notebook"
class "GtkProgressBar" style "clearlooks-progressbar"
widget_class "*.GtkComboBox.GtkButton" style "clearlooks-combo"
widget_class "*.GtkCombo.GtkButton" style "clearlooks-combo"
class "GtkButton" style "clearlooks-button"
class "GtkScrollbar" style "clearlooks-scrollbar"
 
source:
 http://askubuntu.com/questions/337018/firefox-not-affected-by-gtk-theme

Friday, August 14, 2015

ibus in gnome-flashback

dconf-editor

make
org.gnome.desktop.input-sources.sources read

[('xkb', 'jp'), ('ibus', 'anthy')]

or for mozc

[('ibus', 'mozc-jp')]


to set the keyboard layout for mozc edit
/usr/share/ibus/component/mozc.xml

<layout>default</layout>
to
<layout>jp</layout>
 

if the icon flickers (fcxit) resize it to be 22x22
the icon is located at
/usr/share/fcitx/mozc/icon/mozc.png

sources:
http://note.kurodigi.com/ibus-mozc-kbdlayout/
http://zaka-think.com/linux/ubuntu/elementary-os-fcitx/

Tuesday, July 14, 2015

firefox white bar with adwaita theme

To have a dark theme also in firefox

Select light theme in gnome-tweak-tool, but
move
/usr/share/themes/Adwaita/gtk-3.0/gtk-dark.css
to
/usr/share/themes/Adwaita/gtk-3.0/gtk.css

Wednesday, June 24, 2015

windows share from linux

sudo mount -t cifs -o user=fabio //192.168.6.133/share  /tmp/a

if you get the error

mount: Cannot allocate memory

then change the registry on the windows side:

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache - set it to 1 

HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size - set it to 3
source:

http://www.linuxquestions.org/questions/linux-server-73/mount-cifs-cannot-allocate-memory-or-remote-i-o-error-after-data-transfer-4175508385/

Friday, April 24, 2015

opencv2 on natty

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
apt-get install g++-4.6 libgtk2.0-dev pkg-config

opencv 2.4.11:
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.11/


Friday, April 17, 2015

ubuntu old releases apt-get


replace CODENAME with jaunty, etc

## EOL upgrade sources.list
# Required
deb http://old-releases.ubuntu.com/ubuntu/ CODENAME main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-security main restricted universe multiverse

# Optional
#deb http://old-releases.ubuntu.com/ubuntu/ CODENAME-backports main restricted universe multiverse


source:
http://superuser.com/questions/339537/where-can-i-get-the-repositories-for-old-ubuntu-versions

Monday, April 6, 2015

gEDA linux

https://ashwith.wordpress.com/2010/09/10/circuit-simulation-in-gnulinux-lets-begin/

Monday, March 23, 2015

samba mount

smb mnt

to mount from any user add in /etc/fstab

//IP/SHARENAME   /MNTDIR  cifs  user,exec,user=USERNAME,pass=PWD 0 0

where the first user is to allow users to mount, the second is for samba.
exec is for allowing execution of files

you can mount (but the mounter is sudo) from command line with
mount -t cifs -o user=USER -o password=PWD //IP/SHARENAME /MNTDIR

Tuesday, February 3, 2015

sd name (fat32) in linux

 sudo apt-get install mtools

 sudo mlabel -i /dev/sdb1 ::label

in case of the following error
Total number of sectors (7736320) not a multiple of sectors per track (63)!
Add mtools_skip_check=1 to your .mtoolsrc file to skip this test

add to ~/.mtoolsrc as suggested


Friday, January 23, 2015

Agilent u1177a from linux

the bluetooth is a virtual serial, pin 1234, 9600 baud, 8 data bits, 1 stop bit
the following list of commands work

  *Query commands are post-fixed with a "?"
     *For queries regarding the secondary display, append @2 to the command (e.g. CONF? @2)
*IDN?                 - Identification 
SYST:BATT?        - Request batter status. Not sure what units are returned.
CONF?                - Request confirguration (e.g. "VOLT:AC +5.00000000E+00,+1.00000000E-04")
STAT?                - Request unit status. I have not decoded the meaning of the return value for this. (e.g. "000000I00302L00004001")
FETC?                - Request current reading (and FETC? @2 returns current reading on secondary display)
*RST                 - Meter reset
SYST:VERS?        - Unknown, my meter returns 1990.0
SYST:ERR?          - Unknown, probably returns the last error
READ?                 - Request current reading. I don't believe that the @2 option works for this command.
If your meter supports logging (manual or auto) then the following commands can be used:
LOG:AUTO xx        - Request value of auto-log position xx
LOG:HAND xx        - Request value of manual log position xx


source:
http://www.eevblog.com/forum/testgear/agilent-u1272a-data-logging-software-installation/

Sunday, December 21, 2014

brightness laptop

Ubuntu 14.04, xfce (xfce4),

create the file
 /usr/share/X11/xorg.conf.d/20-intel.conf

with content

Section "Device"
        Identifier  "card0"
        Driver      "intel"
        Option      "Backlight"  "intel_backlight"
        BusID       "PCI:0:2:0"
EndSection
 
source:http://itsfoss.com/fix-brightness-ubuntu-1310/ 

Tuesday, November 4, 2014

match qt theme to awaita-dark

apt-get isntall gtk2-engines
(for gtk2 clearlooks)

mkdir .themes
cp /usr/share/themes/Adwaita/ .themes/AdwaitaDark
cd .themes/Adwaita
mv gtk-3.0/gtk-dark.css gtk-3.0/gtk.css


source:
https://bbs.archlinux.org/viewtopic.php?id=151846



replace gtk-2.0/gtkrc with the following

# Color scheme originally contributed by Franco Gotusso as Clearlooks-DarkOrange
# Based on Clearlooks-DarkCoffee by Chibi and edited by bvc as Clearlooks-DarkCoffee2

style "clearlooks-default"
{
  GtkMenuItem::selected_shadow_type = none
  GtkWidget::interior_focus = 1
  GtkButton::default_border = { 3, 3, 3, 3 }
  GtkButton::default_outside_border = { 3, 3, 3, 3 }
  GtkRange::trough_border = 2

  GtkWidget::focus_padding = 1

  GtkPaned::handle_size = 6

  GtkRange::slider_width = 15
  GtkRange::stepper_size = 15
  GtkScrollbar::min_slider_length = 30
  GtkCheckButton::indicator_size = 12
  GtkMenuBar::internal-padding = 0

  GtkTreeView::expander_size = 14
  GtkExpander::expander_size = 16

  GtkTreeView::odd_row_color = "#404040"

  GtkWidget::cursor_color           = "#72706E"
  GtkWidget::secondary_cursor_color = "#72706E"

  xthickness = 1
  ythickness = 1

  fg[NORMAL]        = "#d2cfcc" #Main window text
  fg[PRELIGHT]      = "#E9E9E9" #Highlighted widget text
  fg[ACTIVE]        = "#ADA59D" #Inactive widget text
  fg[SELECTED]      = "#E9E9E9"
  fg[INSENSITIVE]   = "#A18989"

  bg[NORMAL]        = "#393f3f" #Backround
  bg[PRELIGHT]      = "#3465A4" #Highlight Widget
  bg[ACTIVE]        = "#2E3232" #Selected Widget
  bg[SELECTED]      = "#3465A4" #The box words are usually in
  bg[INSENSITIVE]   = "#282B2B" #Not active buttons
  base[NORMAL]      = "#4F524F" #Text area widgets
  base[PRELIGHT]    = "#313131" #Check and radio button background
  base[ACTIVE]      = "#313636" #Unfocused Select
  base[SELECTED]    = "#2F4C6D" #Selected Text area item, and that bar over the tabs.
  base[INSENSITIVE] = "#f5f2ee" #

  text[NORMAL]      = "#EEEEEC" #Text area widget text.
  text[PRELIGHT]    = "#E9E9E9" #
  text[ACTIVE]      = "#ADA59D" #
  text[SELECTED]    = "#E9E9E9" #Selected Text area widget text.
  text[INSENSITIVE] = "#757575" #

engine "clearlooks"
   {
#    sunkenmenubar        = 1       # 0 = disable, 1 = enable
#    menuitemstyle         = 1       # 0 = flat, 1 = 3d-ish (button)
#    listviewitemstyle     = 1       # 0 = flat, 1 = 3d-ish (gradient)
#    progressbarstyle      = 0       # 0 = candy bar, 1 = flat
  }
}

style "clearlooks-wide" = "clearlooks-default"
{
  xthickness = 2
  ythickness = 2
  bg[NORMAL]   = "#414141"
  bg[PRELIGHT] = "#494949"
}

style "clearlooks-button" = "clearlooks-wide"
{
  bg[NORMAL]   = "#414141"
  bg[PRELIGHT] = "#494949"
}

style "clearlooks-notebook" = "clearlooks-wide"
{
  bg[NORMAL] = "#404040"
  bg[ACTIVE] = "#303030"
}

style "clearlooks-tasklist" = "clearlooks-default"
{
  xthickness = 5
  ythickness = 3
}

style "clearlooks-menu" = "clearlooks-default"
{
  xthickness = 2
  ythickness = 1
  bg[NORMAL] = "#404040"
}

style "clearlooks-menu-item" = "clearlooks-default"
{
  xthickness = 2
  ythickness = 3
  fg[PRELIGHT]   = "#E9E9E9"
  text[PRELIGHT] = "#E9E9E9"
  base[PRELIGHT] = "#3465A4"
  base[SELECTED] = "#3465A4"
}

style "clearlooks-menu-itembar" = "clearlooks-default"
{
  xthickness = 3
  ythickness = 3
}

style "clearlooks-tree" = "clearlooks-default"
{
  xthickness = 2
  ythickness = 2
}

style "clearlooks-frame-title" = "clearlooks-default"
{
  fg[NORMAL] = "#e2dfdc"
}

style "clearlooks-panel" = "clearlooks-default"
{
  xthickness = 3
  ythickness = 3
}

style "clearlooks-tooltips" = "clearlooks-default"
{
  xthickness = 4
  ythickness = 4
  bg[NORMAL] = "#3465A4"
}

style "clearlooks-progressbar"    = "clearlooks-default"
{
  xthickness = 1
  ythickness = 1
   fg[PRELIGHT]          = "#e2dfdc"
   bg[NORMAL]             = "#2d1d11"
}

style "clearlooks-combo" = "clearlooks-default"
{
  xthickness = 1
  ythickness = 2
  fg[NORMAL]            = "#141414"
  fg[PRELIGHT]            = "#ed7013"
  fg[ACTIVE]             = "#e2dfdc"
  bg[NORMAL]            = "#414141"
  bg[PRELIGHT]            = "#494949"
}

style "clearlooks-scrollbar" = "clearlooks-default"
{
  fg[NORMAL]            = "#141414"
  fg[PRELIGHT]            = "#e2dfdc"
  fg[ACTIVE]             = "#e2dfdc"
  bg[NORMAL]            = "#414141"
  bg[PRELIGHT]            = "#494949"
}

style "clearlooks-spin" = "clearlooks-wide"
{
  fg[NORMAL]            = "#141414"
  fg[PRELIGHT]            = "#e2dfdc"
  fg[ACTIVE]            = "#e2dfdc"
  bg[PRELIGHT]            = "#414141"
  bg[ACTIVE]             = "#494949"
}

class "GtkWidget" style "clearlooks-default"
class "GtkRange" style "clearlooks-wide"
class "GtkFrame" style "clearlooks-wide"
class "GtkSpinButton" style "clearlooks-spin"
class "GtkStatusbar" style "clearlooks-wide"
class "GtkMenu" style "clearlooks-menu"
class "GtkMenuItem" style "clearlooks-menu-item"
widget_class "*MenuItem.*" style "clearlooks-menu-item"
class "GtkEntry" style "clearlooks-wide"
widget_class "*.tooltips.*.GtkToggleButton" style "clearlooks-tasklist"
widget_class "*.GtkTreeView.GtkButton" style "clearlooks-tree"
widget_class "*.GtkCTree.GtkButton" style "clearlooks-tree"
widget_class "*.GtkList.GtkButton" style "clearlooks-tree"
widget_class "*.GtkCList.GtkButton" style "clearlooks-tree"
widget_class "*.GtkFrame.GtkLabel" style "clearlooks-frame-title"
widget_class "BasePWidget.GtkEventBox.GtkTable.GtkFrame" style "clearlooks-panel"
widget "gtk-tooltips" style "clearlooks-tooltips"
class "GtkNotebook" style "clearlooks-notebook"
class "GtkProgressBar" style "clearlooks-progressbar"
widget_class "*.GtkComboBox.GtkButton" style "clearlooks-combo"
widget_class "*.GtkCombo.GtkButton" style "clearlooks-combo"
class "GtkButton" style "clearlooks-button"
class "GtkScrollbar" style "clearlooks-scrollbar"

emacs open file directly

remove the initial help / splash screen by adding

;; prevent silly initial splash screen
(setq inhibit-splash-screen t)

to .emacs

source:
http://www.win.tue.nl/~aeb/linux/misc/emacs.html


Tuesday, October 21, 2014

Ubuntu XPS 8700

Nvidia Geforce GT 720 installed on Ubuntu 14.04 using

 $ sudo add-apt-repository ppa:xorg-edgers/ppa
$ sudo apt-get update
$ sudo apt-get install nvidia-340


source:  http://linuxg.net/how-to-install-the-nvidia-340-24-driver-on-ubuntu-14-04-ubuntu-13-10-ubuntu-12-04-and-derivative-systems/

Tuesday, October 7, 2014

Ubuntu software center color

If ubuntu software center is unreadable (dark theme)

in
/usr/share/software-center/ui/gtk3/css/softwarecenter.css
change these
@define-color light-aubergine #DED7DB;
@define-color super-light-aubergine #F4F1F3; 


source: http://ubuntuforums.org/showthread.php?t=1913590

Monday, September 29, 2014

Bluetooth serial



module HC-06 (aitendo EGBT-046S-P)


hcitool scan


and get the mac address of the module


then edit /etc/bluetooth/rfcomm.conf as follows


rfcomm0 {

# Automatically bind the device at startup

bind no;

# Bluetooth address of the device

device 11:22:33:44:55:66;


# RFCOMM channel for the connection

channel 1;


# Description of the connection

comment "any description you like";

}


to create the serial /dev/rfcomm0
sudo rfcomm bind rfcomm0

to pair
bluetooth-agent 1234 &
(or when asked for the pin, default is 1234)

to destroy it
sudo rfcomm release rfcomm0

if not in the  dialout group (serial access)
sudo adduser fabio dialout

sources:
http://embeddedprogrammer.blogspot.jp/2012/06/ubuntu-hacking-hc-06-bluetooth-module.html
http://www.exp-tech.de/service/datasheet/HC-Serial-Bluetooth-Products.pdf

Sunday, August 17, 2014

vmare running in the background

if vmware crashes but still runs in the background

vmrun -T player suspend ~/vmware/Office/Office.vmx

(vmrun is from the VIX API installed from
https://my.vmware.com/web/vmware/free#desktop_end_user_computing/vmware_player/5_0|PLAYER-502|product_downloads
)

match the version of the player to the version of the API.
mismatch may cause the error

SSLLoadSharedLibraries: Failed to load OpenSSL libraries. libdir is /usr/lib/vmware

VMware Workstation Error:
VMware Workstation unrecoverable error: (vthread-3)
SSLLoadSharedLibraries: Failed to load OpenSSL libraries. libdir is /usr/lib/vmware
You can request support.


source:
http://superuser.com/questions/610208/vmplayer-crashed-but-vm-is-still-running-how-to-reconnect

Thursday, July 10, 2014

FTDI serial hardware control


microcontroller controls line #CTS (pin 3 of the UB232R module) to stop incoming flow of data.
Vcc=stop, GND=go.

source:
http://www.ftdichip.com/Support/FAQs.htm#HwGen3

Saturday, June 14, 2014

avr dragon

to reset the fuses (of an attiny85) use the hvsp mode (hv serial because there're too few pins to do parallel programming)

avrdude -c dragon_hvsp -p attiny85 -U lfuse:w:0x62:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m -P usb

connections:

avr dragon           mc
20                       4
19                       8
18                        1
17                        2

1                          5
2                          6
3                          7

with pins on the avr dragon numbered as
20  19
.
.
.
2    1

AND CONNECT ON THE DRAGON ITSELF jtag pin 2 to VCC (pin 6)

sources:
http://people.ece.cornell.edu/land/courses/ece4760/AtmelStuff/dragon.pdf



Tuesday, May 13, 2014

quartus on ubuntu 14.04

If the setup does not start and fails without error

 sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0
 
source:http://c0lvlput3r.blogspot.jp/2014/04/installing-quartus2-on-ubuntu-1404-64bit.html 

Thursday, May 8, 2014

Altera-DE0

LINUX


if you get error


Error (209053): Unexpected error in JTAG server -- error code 89
Error (209012): Operation failed


add the file /etc/udev/rules.d/98-altera.rules with the following content


# USB-Blaster

SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6001", MODE="0666", SYMLINK+="usbblaster/%k"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6002", MODE="0666", SYMLINK+="usbblaster/%k"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6003", MODE="0666", SYMLINK+="usbblaster/%k"


# USB-Blaster II
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6010", MODE="0666", SYMLINK+="usbblaster2/%k"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="09fb", ATTRS{idProduct}=="6810", MODE="0666", SYMLINK+="usbblaster2/%k"

source: http://www.alteraforum.com/forum/showthread.php?t=41657


WINDOWS
if panel gives errors for the DLL

"Load DLL (TERASIC_JTAG_DRIVE.dll) fail"

"Fail to connect to FPGA board"

add the bin directory of the quartus software to the system path (control panel)

source: http://www.alteraforum.com/forum/showthread.php?t=24461

Tuesday, April 29, 2014

xmonad on ubuntu 14.04 with gnome-panel

download ubuntu-gnome

create a custom script
 xmodmap .xmodmap
xmonad --replace&

to add mozc (japanese input) you need to log in with gnome (do this before setting the script, which breaks gnome)
 sudo apt-get install ibus-mozc
gnome-control-center
region & language (this menu is missing in fallback, and replaced by text entry)
input source
here press the + and add mozc

start gnome-fallback
 start the script as startup by
Applications/System tools/Preferences/Startup Applications


Wednesday, March 5, 2014

Mathematica copy viewing parameters

For copying the viewing matrix parameters (example from a fast draft to the final figure) copy paste the draft and add //options.
you get ImageSize, ViewPoint and ViewVertical

Mathematica, 3D plot with color independent of the coordinates

to plot 3D data with color independent of the coordinates

data = Table[RandomReal[{0, 10}, 4], {20000}];
Graphics3D[{Hue[Last[#]/10], Point[Take[#, 3]]} & /@ data]


Hue can take 3 parameters . Graphics3D had axes turned off so to change the labels you need to do Axes -> True, AxesLabel -> {Subscript[\[Theta], 1], Subscript[\[Theta], 2],
  h},  BaseStyle -> {FontSize -> 15}


source: https://groups.google.com/forum/#!topic/comp.soft-sys.math.mathematica/nJSMEyrvIgg

Wednesday, January 8, 2014

solidworks split error



if solidworks cannot split

(error: "C:ProgramFiles\Solidworks Corp\Solidworks\fworks\.sldasm

The avove file name is invalid.")
this is a permission problem:

then right click on the solidworks launcher, and in Security give Full control to the user

Tuesday, October 22, 2013

arduino ISP

if you get


avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x11
avrdude: stk500_cmd(): programmer is out of sync

check the IDE version
1.0 (coming with apt-get) gives this error.

1.0.4 does not.

Friday, October 18, 2013

japanese latex



dvipdfmx
** ERROR ** Could not find encoding file "H".

solution:
sudo apt-get install cmap-adobe-japan1


No file C40song.fd.
solution:
sudo apt-get install latex-cjk-japanese latex-cjk-japanese-wadalab


open file as euc-jp in emacs:
C-x ret r
euc-jp
yes

Saturday, October 5, 2013

gtkmm add code to the main loop




MyWindow win;
  win.show(); //this must be given manually!
  while(true){
    g_main_context_iteration (NULL,false);
   myCode();
  }

Friday, October 4, 2013

Create a test video displaying a count up


for i in $(seq 0 10); do convert -size 320x240 xc:white -font Palatino-Bold -pointsize 72 -fill black -draw "text 20,55  '`printf %02d $i`' " img`printf %02d $i`.png ; done

avconv -r 1 -i "img%02d.png" -r 1 -vcodec mpeg4  test.avi

where the two -r indicate the input rate (in fps) and the output rate




sources:
http://www.linuxandlife.com/2012/09/how-to-create-simple-text-image-with.html
http://superuser.com/questions/624567/ffmpeg-create-a-video-from-images#12160155
https://trac.ffmpeg.org/wiki/Create%20a%20video%20slideshow%20from%20images

Wednesday, September 25, 2013

modela pin

mdx40a pin settings:
pin 3mm
home tick on use drill the hole
depth 6.50
tool-up 1.00

feed speed 22
spindle 6000
cutting in amount 2.40

Sunday, August 25, 2013

roland mdx 40a

when srp player gives the error

srp player install the driver for the cutting machine

install the drivers, and as port give "FILE"


source


http://support.rolanddga.com/docs/Documents/departments/Technical%20Services/Manuals%20and%20Guides/RSPG-SB00055_SRPPlayer.pdf



To convert an image to engraving use
zsurf4


to engrave pcb

extract
eagle_files4rol­and_modela.zip
from source

add



[FABLAB_MILLING]
Type = PenPlotter
Long = "Roland Modela MDX-40"
Init = "PA;PA;VS1;!VZ4;!MC1;!PZ-25,800;\n"
Reset= "PU0,0;!MC0;\n"
Move = "PU%d,%d;\n"
Draw = "PD%d,%d;\n"
ResX     = 2540
ResY     = 2540


[FABLAB_DRILLING]
Type = PenPlotter
Long = "Roland Modela MDX-40"
Init = "PA;PA;VS1;!VZ2;!MC1;!PZ-50,800;\n"
Reset= "PU0,0;!MC0;\n"
Move = "PU%d,%d;\n"
Draw = "PD%d,%d;\n"
ResX     = 2540
ResY     = 2540


scale=1







add

[FABLAB_MILLING]
Type = PenPlotter
Long = "Roland Modela MDX-16/MDX-20"
Init = "PA;PA;VS1;!VZ4;!MC1;!PZ-10,100;\n"
Reset= "PU0,0;!PZ20,0;PD0,0;!MC0;\n"
Move = "PU%d,%d;\n"
Draw = "PD%d,%d;\n"

[FABLAB_DRILLING]
Type = PenPlotter
Long = "Roland Modela MDX-16/MDX-20"
Init = "PA;PA;VS1;!VZ2;!MC1;!PZ-20,100;\n"
Reset= "PU0,0;!MC0;\n"
Move = "PU%d,%d;\n"
Draw = "PD%d,%d;\n"


to the end of /opt/eagle-6.4.0/bin/eagle.def

in the CAM processor,
scale =2.5
offset=board width * 2.5\

on the three tabs

source:http://mlab.taik.fi/paja/?p=1874


to launch the job use
http://www.rolanddg.co.za/SupportPage/EGX-20/DropOut.zip

source:
http://www.rolanddg.co.za/SupportPage/MDX-40A.html

Thursday, July 18, 2013

Mathematica fonts problem with inkscape

If the fonts are broken,
when saving (in eps) from mathematica select options/ and disable the "Include Mathematica fonts".

Make the fonts of Mathematica available to inkscape

ln -s /usr/local/Wolfram/Mathematica/9.0/SystemFiles/Fonts/ .fonts
ln -s /usr/local/Wolfram/Mathematica/9.0/SystemFiles/IncludeFiles/TeX/texmf/fonts/ .fonts
sudo fc-cache -f -v

source:
http://pages.uoregon.edu/noeckel/MathematicaGraphics.html#NoSpecialFonts


Tuesday, July 16, 2013

eps crop

solution 1
gs -dNOPAUSE -dBATCH -q -sDEVICE=bbox img.eps
and replace the bounding box of the file with the two lines obtained

source: http://tex.stackexchange.com/questions/22063/how-to-fix-eps-with-incorrect-bounding-box


solution 2 (the font may become ugly)
ps2pdf img.eps img.pdf
pdfcrop img.pdf imgc.pdf
pdf2ps imgc.pdf imgc.eps

inkscape does not export text in eps

save as pdf
ps2ps img.pdf img.ps
ps2eps img.ps img.eps

Reliable Long equation to pdf

In mathematica

expression//TraditionalForm

save selection as... eps

ps2pdf -dEPSFitPage-sPAPERSIZE=jisb0  formula.eps formula.pdf
(note: -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=16712 instead of -sPAPERSIZE=jisb0 seems to produce white text on white bg)

pdfcrop formula.pdf formulac.pdf

Friday, July 12, 2013

Equations in latex

system of equations

individually numbered

\begin{align
\end{align}

not numbered


\begin{align*}
\end{align*}

single number


\begin{equation}
\begin{aligned}
  dr_t &= \kappa ( \theta - r_t ) dt + \sigma_r r^{\xi} dW_t \\
  dA_t &= \mu A_t dt + \sigma_A^{\alpha} dZ_t,
\end{aligned}
\end{equation}


source:
http://tex.stackexchange.com/questions/13396/how-to-get-only-one-vertically-centered-equation-number-in-align-environment-wit


only last


\documentclass{article}
\usepackage{amsmath}
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\begin{document}
\begin{align*}
a &=b \\
  &=c \numberthis \label{eqn}
\end{align*}
Equation \eqref{eqn} shows that $a=c$.
\begin{equation}
d = e
\end{equation}
\end{document}

source: http://tex.stackexchange.com/questions/42726/align-but-show-one-equation-number-at-the-end

matrix

\[

\begin{bmatrix}
a_{x,1} b_{y,1} -  a_{y,1} b_{x,1} & 0\\
0                             & a_{x,2} b_{y,2} -  a_{y,2} b_{x,2} \\
\end{bmatrix}=
\]