git
How to deal with git commits under no branch#see all your untracked commits
git reflog
#create new branch
git branch new_branch
#now cherry pick all commits you get by git reflog
git cherry-pick 2355
...
#Working with subtree merge
git remote add -f mikrix https://xxx@bitbucket.org/xxx/repo.git
git merge -s ours --no-commit mikrix/yourBranchtToMerge
git read-tree --prefix=lib/mikrix/src/ -u mikrix/yourBranchToMerge
git commit -m "Mikrix merged as subdirectory"
git pull -s subtree mikrix master
#Working with git subtree (works fine)
#create link to git-subtree (on ubuntu)
sudo chmod +x /usr/share/doc/git/contrib/subtree/git-subtree.sh sudo ln -s /usr/share/doc/git/contrib/subtree/git-subtree.sh /usr/lib/git-core/git-subtree #add remote repository
git remote add -f mikrix https://xxx@bitbucket.org/xxx/repo.git
#add subtree
git subtree add -P lib/mikrix/src mikrix/Linux-dev --squash
# lib/mikrix/src - directory where to put remote repo
# mikrix/Linux-dev - remote branch
# --squash ...
#check changes in subtree
git subtree pull --prefix lib/mikrix/src mikrix Linux-dev --squash
#git bundle
git bundle create my.bundle <base commit> HEAD
<base commit> can be relative <-N>
git bundle create my.bundle <base commit> HEAD --branches --tags
https://schneide.wordpress.com/2015/10/13/transferring-commits-via-git-bundles/
add certificate to store#Working with git subtree (works fine)
#create link to git-subtree (on ubuntu)
sudo chmod +x /usr/share/doc/git/contrib/subtree/git-subtree.sh sudo ln -s /usr/share/doc/git/contrib/subtree/git-subtree.sh /usr/lib/git-core/git-subtree #add remote repository
git remote add -f mikrix https://xxx@bitbucket.org/xxx/repo.git
#add subtree
git subtree add -P lib/mikrix/src mikrix/Linux-dev --squash
# lib/mikrix/src - directory where to put remote repo
# mikrix/Linux-dev - remote branch
# --squash ...
#check changes in subtree
git subtree pull --prefix lib/mikrix/src mikrix Linux-dev --squash
#git bundle
git bundle create my.bundle <base commit> HEAD
<base commit> can be relative <-N>
git bundle create my.bundle <base commit> HEAD --branches --tags
https://schneide.wordpress.com/2015/10/13/transferring-commits-via-git-bundles/
get certificate (pem or crt)
each certificate looks like:
-----BEGIN CERTIFICATE-----
MIIDATCCAmqgAwIBAgIJAKLLZrR6xlgQMA0GCSqGSIb3DQEBBQUAMF8xCzAJBgNV
...
w+RTuliF5I8NUeLk7/2iqBwn6BdqNbPNSmGeWdkOhzCtqWED2NJYBOSe8Pb0beBz
NLOeT8E=
-----END CERTIFICATE-----
copy this file to your ca share folder
/usr/local/share/ca-certificate
sudo cp ~/cert.crt /usr/local/share/ca-certificate
run certificate updating tool
sudo update-ca-certificates
this will add link to your certificate file to certificate folder: /etc/ssl/certs/ (/etc/ssl/certs/cert.pem) and then link it to the one crt file /etc/ssl/certs/ca-certificates.crt
File utils
Gparted
how to remove / change GPT table:
sudo apt-get install gdisk
gdisk <device>
->select r
then use what you need, I convert GPT into MBR
set terminator window size
~/.config/terminatoredit, or add line with size
[layouts]
[[default]]
[[[child1]]]
type = Terminal
parent = window0
[[[window0]]]
type = Window
parent = ""
size = 700, 500
add new resolution for monitor
#!/bin/sh
#generate mode parameters
cvt 1920 1200
#create new mode
xrandr --newmode "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
#add mode
xrandr --addmode VGA1 1920x1200_60.00
xrandr --output DP3 --off --output DP2 --off --output DP1 --off --output HDMI3 --off --output HDMI2 --off --output HDMI1 --off --output LVDS1 --off --output VGA1 --mode 1920x1200_60.00 --pos 0x0 --rotate normal
resize picture
for i in $( ls DSC*.JPG); do convert -resize 50% $i resize/sm$i; done
add fonts for user
* in your home directory, create .fonts/
mkdir .fonts
* copy font files to the new location
* update your font cache fc-cache -fv
LLVM for cmake
$export CC=/usr/bin/clang
$CXX=/usr/bin/clang++
cmake -D_CMAKE_TOOLCHAIN_PREFIX=llvm- CMakeLists.txt
make
Add virtual serial port
install socat
$socat PTY,link=COM8 PTY,link=COM9
Add virtual serial port
install socat
$socat PTY,link=COM8 PTY,link=COM9
will create two devices COM8 and COM9
connect socket with serial port
$sudo socat UNIX-CONNECT:/tmp/socketName PTY,link=COM2
Windows machine on Virtualbox Shared folders slow
http://www.virtualbox.org/manual/ch12.html#idp57235968
Performance for accesses to shared folders from a Windows guest might be decreased due to delays during the resolution of the VirtualBox shared folders name service. To fix these delays, add the following entries to the file\windows\system32\drivers\etc\lmhosts of the Windows guest:
255.255.255.255 VBOXSVR #PRE
255.255.255.255 VBOXSRV #PRE
After doing this change, a reboot of the guest is required.
connect socket with serial port
$sudo socat UNIX-CONNECT:/tmp/socketName PTY,link=COM2
Windows machine on Virtualbox Shared folders slow
http://www.virtualbox.org/manual/ch12.html#idp57235968
Performance for accesses to shared folders from a Windows guest might be decreased due to delays during the resolution of the VirtualBox shared folders name service. To fix these delays, add the following entries to the file\windows\system32\drivers\etc\lmhosts of the Windows guest:
255.255.255.255 VBOXSVR #PRE
255.255.255.255 VBOXSRV #PRE
After doing this change, a reboot of the guest is required.
MSP430
sudo
apt-get
install
msp430-libc binutils-msp430 gcc-msp430 msp430mcu gdb-msp430
http://michael-rushanan.blogspot.sk/2013/07/ubuntu-1304-my-experience-with-mspdebug.html
(launchpad)
update udev rules for rf2500
sudo usermod -a -G plugdev username
installing msp430 eclipse plugin
http://eclipse.xpg.dk
edane
run eDane application
javaws eDane.jnlp
openssl server
openssl s_server -CAfile ca.pem -cert server.pem -key server.key -accept 4444 -state -Verify 5
openssl view pem certificate
openssl x509 -in freesoft-certificate.pem -noout -text
openssl generate cert-key pair
privete key:
openssl genrsa -des3 -out private.key 2048
public cert:
openssl req -new -x509 -key private.key -out public.crt
Generating Client/Server certificates with a local CA
*make sure openssl points to the correct installation (%which openssl). Mine is aliased to /usr/local/openssl/bin/openssl
Generate a CA
1) openssl req -out ca.pem -new -x509
-generates CA file "ca.pem" and CA key "privkey.pem"
Generate server certificate/key pair
- no password required.
2) openssl genrsa -out server.key 1024
3) openssl req -key server.key -new -out server.req
4) openssl x509 -req -in server.req -CA CA.pem -CAkey privkey.pem -CAserial file.srl -out server.pem
-contents of "file.srl" is a two digit number. eg. "00"
Generate client certificate/key pair
5) Either choose to encrypt the key(a) or not(b)
a. Encrypt the client key with a passphrase
openssl genrsa -des3 -out client.key 1024
b. Don't encrypt the client key
openssl genrsa -out client.key 1024
6) openssl req -key client.key -new -out client.req
7) openssl x509 -req -in client.req -CA CA.pem -CAkey privkey.pem -CAserial file.srl -out client.pem
-contents of "file.srl" is a two digit number. eg. "00"
8) DONE
Examle:
CA pwd: testPwd
challenge pwd: <no pwd>
client.key passwor: testclient
//CA
openssl req -out ca.pem -new -x509
mv privkey.pem ca-private.key
//server
openssl genrsa -out server.key 1024
echo 01 > file.srl
openssl req -key server.key -new -out server.req
openssl x509 -req -in server.req -CA ca.pem -CAkey ca-private.key -CAserial file.srl -out server.pem
//client
openssl genrsa -des3 -out client.key 1024
openssl req -key client.key -new -out client.req
openssl x509 -req -in client.req -CA ca.pem -CAkey ca-private.key -CAserial file.srl -out client.pem
Verify certificate with own CA file
openssl verify -CAfile ca.pem client.pem
Verify certificate with CA and intermediate CA (depth =2)
* client cert was signed with intermediate CA
openssl verify -CAfile ca.pem -untrusted intermediate-ca.pem client.pem
Verify certificate if CA is web based authority you have installed in your cert store
openssl verify client.pem
Verify if certificate and key match
The `modulus' and the `public exponent' portions in the key and the Certificate must match
$ openssl x509 -noout -text -in server.crt
$ openssl rsa -noout -text -in server.key
and do it automatically:
$ (openssl x509 -noout -modulus -in server.pem | openssl md5 ;\
openssl rsa -noout -modulus -in server.key | openssl md5) | uniq
Get SD card linux partition with minimum size
resize your sdcad to minimum size. you can add some bytes after
$sudo gparted
list your partitions from sdcard
$fdisk /dev/mmcblk0
Command (m for help): p
Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ea414
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 2048 104447 51200 c W95 FAT32 (LBA)
/dev/mmcblk0p2 104448 3891199 1893376 83 Linux
Command (m for help): q
or use
$sudo fdisk -l /dev/mmcblk0
and final command:
$sudo dd if=/dev/mmcblk0 of=/home/michal/images/raspi.img bs=512 count=3891200
Get back image to SD card
$dd if=/home/michal/images/raspi.img of= /dev/mmcblk0
then resize partition by gparted or
create file in your image (mount it ) and in root file system and run command:
$touch /.rootfs-repartitionThis command create file, which tells operating system to resize partition while booting.
then umount and run
$dd if=/home/michal/images/raspi.img of= /dev/mmcblk0
Mounting image file with two partitions
view partition:
$fdisk -l images/raspi.img
Disk images/raspi.img: 1992 MB, 1992294400 bytes
255 heads, 63 sectors/track, 242 cylinders, total 3891200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ea414
Device Boot Start End Blocks Id System
images/raspi.img1 * 2048 104447 51200 c W95 FAT32 (LBA)
images/raspi.img2 104448 3891199 1893376 83 Linux
Notice the start offset of the second (root) partition = 104448 blocks, = 53477376 bytes (1 block = 512 bytes).
Use this offset to mount the rootfs partition:
sudo mkdir /mnt/raspi-root
sudo mount -o loop,offset=53477376 pidora-18-r2c.img /mnt/raspi-root
Building mikrix based app on raspi
$cd your-app
$mkdir -p target/raspi
$cd target/raspi
$cmake ../../core -DCMAKE_TOOLCHAIN_FILE=../../linux-raspi-gcc-armv6hl.cmake -DCMAKE_BUILD_TYPE=Debug -DRASPI=1
konica minolta install printer
$sudo apt get install min12xxw
cups server:
http://localhost:631/
cups add root user:
$sudo lppasswd -g sys -a root
lubuntu after login - login screen appear again (can't login)
$mv .Xauthority .Xauthoritybak
$sudo shutdown now -r
maven
//mount raspi file system first
mvn clean install -P raspi
mvn clean install -P debug
mvn clean install
view DVD movie from disc in mplayer
go to VIDEO_TS directory and there run this command
mplayer -dvd-device . dvd://1
view DVD movie from disc in mplayer
go to VIDEO_TS directory and there run this command
mplayer -dvd-device . dvd://1
virtualbox - Allow using USB
Add your user to vboxusers group
sudo usermod -a -G vboxusers $USER
visual binary file compare
sudo apt-get install vbindiff
zip more files to one archive
zip -r final.zip txt1.txt data.bin about.txt
add new file to archive (file path will be same as inserted in commandline)
zip -g final.zip addedfile.txt
remove/delete file from archive
zip -d final.zip addedfile.txt
Sudo with entered password
echo mypassword | sudo -S command
Change permission to application to run as root with your user (added SUID)
echo "passwors" | sudo -S chown root:root filename | sudo -S chmod +s filename
hex editor / viewer / comaprator
vbindiff
ping address range
fping -ag 192.168.1.0/24
Sudo with entered password
echo mypassword | sudo -S command
Change permission to application to run as root with your user (added SUID)
echo "passwors" | sudo -S chown root:root filename | sudo -S chmod +s filename
hex editor / viewer / comaprator
vbindiff
ping address range
fping -ag 192.168.1.0/24
gdb no stop on SIGILL
because of no possibility to find type of ARM processor version / architecture, some application try to find supported instructions. When they fail, it will signal SIGILL
To allow running your application in gdb type this to gdb commandline:
handle SIGILL pass nostop noprint
1. Edit /etc/NetworkManager/NetworkManager.conf to comment out the line containing dns=dnsmasq (add a # at the beginning of that line).
2. Restart NetworkManager with service network-manager restart or (sudo restart network-manager)
src: http://unix.stackexchange.com/questions/59414/understanding-dns-in-ubuntu-12-04
show calendar from certain date with starting date Monday
ncal -bM <month> <year.
No comments:
Post a Comment