Skip to main content

Posts

IORegistryExplorer on macOS Dark Mode issue fix

IO Registry Explorer is a utility developed by Apple which allows you to watch the I/O Registry on your macOS. (Original:  https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/art/registryexplorer.jpg ) If you are using the IORegistryExplorer on macOS while working with Dark Mode enabled, then you probably noticed the fact that the explorer doesn't fit the new DarkMode, hence the UI might look like that: Which makes it hard to read the content. I found this article  which shows you how to disable DarkMode for a specific application. Running the following commands: osascript -e 'id of app "IORegistryExplorer"' defaults write com.apple.IORegistryExplorer NSRequiresAquaSystemAppearance -bool yes Solves the issue and make it usable again. Have fun, Tal Kain
Recent posts

Standalone IPython using PyInstaller and VirtualEnv

I decided that I want to create a standalone IPython executable that I can distribute. This executable should be: Run as a standalone, even if there is no Python installed on the machine Have all required packages even if they aren't installed on the machine Doesn't have extra packages in it (just what needed) Single executable (no shared objects) In order to achieve this task I used PyInstaller , which according to this StackOverflow post  seems like one of the good options to do so. I also wanted to make my environment as clean as possible, so I installed virtualenv : virtualenv ipython_env/ source ipython_env/bin/activate Inside this environment, I ran the following pip command to install PyInstaller and IPython: pip install pyinstaller pip install ipython  Following  rgtk 's comment: https://stackoverflow.com/a/31412509/132847 , I created the following script: from IPython import embed embed() and called it ipython.py From PyInstaller

Compiling lsof for iOS device on Mac OSX

I started making a small research on my jailbroken iOS device and I was wondering which files does a specific process touches while I was using it. In order to do so, I wanted to use the famous lsof , so I downloaded the package from saurik's packages using Cydia, only to find out that the given lsof is not working on my device: lsof: PID 40 information error: Cannot allocate memory lsof: PID 39 information error: Cannot allocate memory lsof: PID 38 information error: Cannot allocate memory lsof: PID 37 information error: Cannot allocate memory lsof: PID 36 information error: Cannot allocate memory lsof: PID 35 information error: Cannot allocate memory lsof: PID 33 information error: Cannot allocate memory lsof: PID 31 information error: Cannot allocate memory After trying to figure it out, I decided that it would be the best to just try compiling my own lsof and use it on the device (I also liked the challenge :-) ) So my journey begins with downloading lsof from Apple'

ipython && tmux - saving history to a file

Hey, I had an ipython console open inside a tmux split window and I needed to save the history to a file. Since I can't copy & paste the data from the screen (I was in the middle of a session, so the next time I would configure it correctly using  this ). So I found a quicker way,  Roberto Z  wrote in his comment  that in order to save the session's history you can use readline  package: import readline readline.write_history_file('/home/user/current_history') This works like a charm in Ubuntu. - Tal Kain

Linux: iptables: Removing a collection of iptables rules at once

Here is a small trick for removing several iptables rules at once, Let's assume we would like to add some rules: iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE I can use the comment match and add a comment to this line: iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE -m comment --comment "SOME_COMMENT" Now, cleaning all the relevant rules in a simple command would be: # iptables-save | grep -v SOME_COMMENT | iptables-restore  Probably not the best way to do it, but it's simple and fast. Have fun, -Tal Kain

Installing NVIDIA CUDA on an Amazon Web Services (AWS) machine (Ubuntu 14.04)

Disclaimer: I wrote this post several months ago and did not publish it for unknown reason, I assume that the information below is still relevant and correct. While trying to install the machine, I started my research by reading  Traun Leyden 's great blog post:  http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/  (you should too) Amazon offers two types of machines that includes GPUs ( https://aws.amazon.com/ec2/instance-types/#g2 ) High-performance NVIDIA GPUs, each with 1,536 CUDA cores and 4GB of video memory While writing this post, I used the  g2.2xlarge  machine, but you can also use the 8xlarge. This will be quick and simple: 1. Make sure you are fully up-to-date sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade  When prompted, choose the "install maintainer package...." 2. Reboot the machine (so it will load the new kernel) 3. Install the kernel's header f

Ubuntu Linux: cannot find modules.dep.bin

While trying to load some kernel modules in one of my projects, I encounter the following errors: root@ubuntu:~# modprobe carl9170 modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/3.10.17/modules.dep.bin' and the following error: modprobe: ERROR: ../libkmod/libkmod-index.c:821 index_mm_open() magic check fail: d00dfeed instead of b007f457 To solve this issue, run depmod # depmod From http://manpages.ubuntu.com/manpages/dapper/man8/depmod.8.html : "depmod creates a list of module dependencies, by reading each module under /lib/modules/ version and determining what symbols it exports, and what symbols it needs. By default this list is written to modules.dep in the same directory. If filenames are given on the command line, only those modules are examined (which is rarely useful, unless all modules are listed)." After running depmod, everything should work as expected. - Tal K

Ubuntu: schroot cannot bind the home directory

Hey everyone, Several weeks ago I had to compile gdb and strace to a target device that runs on ARM (EBI).  This time, instead of cross compile it, I decided to use my favorite way - schroot environment. I had the pleasure of using schroot on my old system - an Ubuntu 12.04 desktop, and this was the first time I needed to use it on my current Ubuntu 14.04 system. The problem started after creating the schroot environment and trying to use it. As you will see in the following lines, I tried getting into the environment and got an error: root@ubuntu:/home/talkain# schroot -c ubuntu-armel -u talkain W: line 11 [ubuntu-i386] union-type: Configuration key name ‘union-type’ is not a permitted name. W: line 11 [ubuntu-armel] union-type: Configuration key name ‘union-type’ is not a permitted name. W: Failed to change to directory ‘/home/talkain’: No such file or directory I: The directory does not exist inside the chroot. Use the --directory option to run the command in a d

Ubuntu: Installing a missing ath3k firmware

While trying to prepare a new Ubuntu box to use a new card based on the Atheros chipset, I encounter the following error: Bluetooth: Firmware file "ath3k-1.fw" not found According to  http://wireless.kernel.org/en/users/Drivers/ath3k : ath3k is the Linux Bluetooth driver for Atheros AR3011/AR3012 Bluetooth chipsets. I saw this blog post: http://hexwave.blogspot.com/2011/04/debian-6-with-atheros-3011-ath3k-usb.html So I decided to try installing the package linux-firmware which contains the relevant file (I used  dlocate  to $ dlocate linux-firmware | grep -i ath3 linux-firmware: /lib/firmware/ath3k-1.fw or you can find it by searching for ath3k: $ dlocate ath3k-1.fw linux-firmware: /lib/firmware/ath3k-1.fw I just ran: # apt-get install linux-firmware and it fixed it by installing the missing firmware file. Good luck! Tal Kain

Ubuntu && Python: Solving "ImportError: No module named OpenSSL"

In order to easily solve the following Python import error on Ubuntu systems: ImportError: No module named OpenSSL You can install the relevant package using the following command: $ sudo apt-get install python-openssl  The other option would be to install the OpenSSL paackage using Python's pip : $ sudo pip install pyOpenSSL Good luck! - Tal Kain

Ubuntu and Gnome: Moving the Close, Maximize and Minimize buttons to the right corner.

A quick tip: One of the first things that I do after setting a new Ubuntu system is changing the location of the Close && Minimize && Maximize buttons to be on the right side of the window. There are several ways to achieve this, but the simplest way is using the command line, running the following command: gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close" (The colon should be on the left side of the string) -Tal

Ubuntu: Fixing issues with apt-get after installing Steam client

After installing the latest Steam client ( http://store.steampowered.com/ ) on my Ubuntu 14.04 using the Ubuntu Software Center, I decided to install another package using the package manager. As a first step I ran apt-get update , which (you guessed correctly) failed fetching several index files: Err https://private-ppa.launchpad.net precise/main amd64 Packages               HttpError401 Err https://private-ppa.launchpad.net precise/main i386 Packages                 HttpError401 Ign https://private-ppa.launchpad.net precise/main Translation-en_US           Ign http://security.ubuntu.com trusty-security/main Translation-en_US     ..... ...  W: Failed to fetch https://private-ppa.launchpad.net/commercial-ppa-uploaders/steam/ubuntu/dists/precise/main/binary-amd64/Packages  HttpError401 W: Failed to fetch https://private-ppa.launchpad.net/commercial-ppa-uploaders/steam/ubuntu/dists/precise/main/binary-i386/Packages  HttpError401 E: Some index files failed to download. They have

Running virt-manager from its master branch (1.0.1) on Ubuntu 14.04

Hey all, After upgrading my system from Ubuntu 12.04 to Ubuntu 14.04 I decided to check whether the latest package of virt-manager  (  http://virt-manager.org/ ) comes with the feature that I needed the most - snapshots. Unfortunately, The current Ubuntu 14.04's version of virt-manager is still based on the 0.9 branch, So I decided to clone the latest version from the project's git repository (  https://git.fedorahosted.org/git/virt-manager.git ) and try it out. While doing so, I had several issues which I will list here so you won't have to waste your time doing the same research. Summary for busy people There are several packages that you will need to install: $ sudo apt-get install gir1.2-libvirt-glib-1.0 python-ipaddr libosinfo-bin libosinfo-1.0-dev libgtk-3-dev gir1.2-gtk-vnc-2.0 python-spice-client-gtk gir1.2-spice-client-gtk-3.0 This should fix all the following issues. End of summary for busy people After the git-clone's process was over, I r

Saving space on an SSD hard drive using Sysinternal’s Junction

(NOTE: This is a post that I made on March 4, 2012 that I re-post on this blog after restoring it using archive.org ) ---------------------------------------------------------------------------------------------------------- Not so long ago I decided to buy myself a new computer (since my old one could handle the pressure), I bought myself two hard drives: OCZ Vertex2 60GB Western Digital Caviar Blue (1TB) The SSD for the operating system and the Caviar Blue for all my data. I installed my Windows 7 Ultimate edition (with no SP1), Visual Studio, Office and updated them all using Windows Update. After doing so, I was amazed to find out that I had only 20GB left on my SSD drive – bummer… In order to find out what is taking me so much space I used WinDirStat ( http://windirstat.info ) and find out that my C:\WINDOWS\Installer folder took almost 6GB of my expensive SSD space! After searching the web for a while I found out about Mark Russinovich’s tool called "Juncti

BinDiff error: "Can't start disassembler. Please set correct path in the main settings first"

After installing  BinDiff  and running the application for the first time on my Windows 7 x64 machine, I tried comparing two different binaries but got an error in the middle of the process: Can't start disassembler. Please set correct path in the main settings first The solution for this error is very simple: While installing BinDiff, the installation process asks for the installation path of IDA. The default path (on x64 machine) would be C:\Program Files (x86)\IDA\. This is not always correct. At my case the installation was at C:\Program Files (x86)\IDA 6.3\. Moving the path inside BinDiff will not be sufficient since part of BinDiff's files are still on the old directory. Easiest way to fix it (or by doing it in advance): Uninstall BinDiff and install it while pointing to the correct IDA's path. -Tal

Python PIP Error: Unable to find vcvarsall.bat

While trying to install the Python's  PIL  package on my Windows 7 machine using  pip  I came across this error: Error: Unable to find vcvarsall.bat Although I had Visual Studio 2010 installed, and made sure the batch file exists and the batch file creates the compilation environment correctly, I still got this error. Googling the issue brought this question  with this specific  solution . The short answer (credits to  fmuecke ) is to point the environment variable  VS90COMNTOOLS to the value of   VS100COMNTOOLS . SET VS90COMNTOOLS=%VS100COMNTOOLS% This solved the issue. -Tal