Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

Mar 9, 2017

just paste my text!

It's very annoying when sites/applications block copy-paste out of some idiotic conclusion that it improves system security. Here is a novel idea - make it a configuration option.
In a mean time here is a script that I've adopted from https://github.com/EugeneDae/Force-Paste
I've added delay that allows me to switch between applications to Copy and then later Paste.

Enjoy.

Jan 9, 2014

IP geolocation from command line on OSX

Internet contains zillion of sites bloated with banners, which basically give you the same data: given the IP address, provide some info on where this IP is coming from.

Same basic information can be accessed from command line, here is how you configure it, assuming your OSX machine has brew/port, and can compile C source code.

This will install geoiplookup utility:
git clone https://github.com/maxmind/geoip-api-c.git
cd geoip-api-c/
autoreconf -ivf
./configure
make
sudo make install

Now we need the actual GeoIP databases that utility will use. You can buy more accurate data, but we'll use the free, less accurate for now:

cd /tmp/
curl -O http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
curl -O http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz
curl -O http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
curl -O http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz
curl -O http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
curl -O http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz

find . -name "Geo*.gz" | xargs -I {} gunzip {}
mv GeoLiteCityv6.dat GeoIPCityv6.dat
mv GeoLiteCity.dat GeoIPCity.dat

sudo mv Geo*.dat /usr/local/share/GeoIP/

Sample run:
geoiplookup 8.8.8.8

GeoIP Country Edition: US, United States
GeoIP City Edition, Rev 1: US, N/A, N/A, N/A, N/A, 38.000000, -97.000000, 0, 0
GeoIP ASNum Edition: AS15169 Google Inc.

Jul 12, 2013

Running LTspice IV on OSX

UPDATE:
As Helmut Sennewald mentioned in comments, Linear published OSX native version of LTSpice - http://www.linear.com/designtools/software/#LTspice



The following information will be useful only for older OSX versions.

Originally I considered using MacSpice, but unfortunately it lacks UI to draw circuits, and I don't see a reason to be limited to console input.
LTspice is a Windows program, and hence cannot natively run on OSX. WINE software can emulate Windows good enough for some programs to run, and luckily LTspice is one of them. There is more than one way to skin a cat, but I used MacPorts:
sudo port install wine
This runs for a while, and requires XCode. When WINE installation is complete, download LTspice, and launch the installer via WINE:
wine LTspiceIV.exe
Launching the actual program:
wine ~/.wine/drive_c/Program\ Files/LTC/LTspiceIV/scad3.exe


Mar 12, 2011

mysql for python on Mac

Assuming that you where able to install Mysql and Python Mysql package (mysql-python-1.2.3)
The following error appears when trying to  import MySQLdb:


dlopen(.../.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.16.dylib
  Referenced from: .../.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
  Reason: image not found


This happens because mysql client libraries are installed in standard unix locations, which are not standard for Mac...

Adding this environment variable fixes this quirk:
DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

Another possible solution which could work, was updating the Rpath in _mysql.so, but egg-tmp location is rebuilt during process restart, so it's not really an option.

This wouldn't work:
sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib ~/.python-eggs/MySQL_python-1.2.3-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so