New answers tagged

0

Taken from this gist: Install brew install dnsmasq Setup Create config directory mkdir -pv $(brew --prefix)/etc/ Setup *.dev echo 'address=/.dev/127.0.0.1' > $(brew --prefix)/etc/dnsmasq.conf You should probably add strict-order to dnsmasq.conf to keep nameserver order of resolv.conf (see here). Autostart Work after reboot sudo cp -v $(brew ...


3

Mac uses BSD ls. See man ls for details. The format of LS_COLORS is different. The variable name isn't even LS_COLORS, it's LSCOLORS. The links I found that were most helpful in figuring this out were this blog post, and this article which was linked to from the blog post. The default value for LSCOLORS is exfxcxdxbxegedabagacad. To leave everything at ...


0

Do this in VirtualBox. Just set the Live CD iso as your boot device and boot your machine. You should have no problems.


1

HELP 1 Due to the whitespace you need quoting: INPUT= "${file##*/}" OUTPUT= "${file%.txt}"_exd.txt It seems a bit strange, though, that there is a space between INPUT= and the file name. HELP 3 If you have a file input_1.txt then ${file%.txt}_1.txt becomes input_1_1.txt. I would match the exact file name: for file in ~/Desktop/parent\ ...


1

I know that this has already been resolved for OP, but for anyone stumbling upon this question, this seems to be a 10.11 El Capitan only problem. I tried and was able to delete files with this character in OS X 10.4 Tiger and OS X 10.10 Yosemite, so it very likely works on the other ones.


1

Of course the answer is very opinion based, but I would go with Ubuntu (or any of its derivatives like Kubuntu) as it offers a huge community (e.g. at http://ubuntuforums.org/ or the askubuntu part of the stack network) that is really helpful. Also, many blog posts etc. deal with Ubuntu. As you are new to Linux, this is what you should look out for. On the ...


0

I think this is a matter of opinion. Also, take in account there is hundreds of posts in Internet informing about the differences between distributions. http://lifehacker.com/5889950/how-to-find-the-perfect-linux-distribution-for-you Anyway, I agree with the link, I am also a beginner and using Linux Mint.


0

Some time ago I've found these functions in kenrob's .vimrc in his dotfiles repository: " Removes the ^M character from the end of every line function! RemoveM() :%s/^M$//ge endfunction " Replaces the ^M character with a carraige return native to the system function! ReplaceM() :%s/^M/\r/ge endfunction So you can easily adopt these functions and ...


0

The mv command moves /Library/Caches/com.apple.iconservices.store to com.apple.ic in the current directory. That means that the data is kept around, but since it is no longer present in the place where the system looks for it, it stops having any effect. The name com.apple.ic isn't anything special, you can pick another name if you want. You can undo this ...


0

Mac OS X lets you allocate "a lot", though the system may flail frantically or be just fine, depending on how that allocated memory is used by any subsequent code. I probably had to pkill the following code after it allocated "a lot" of integers (via the -M flag), though it's been a while since I tested on Mac OS X. /* # (Ab)uses memory via the allocation ...


1

A rewrite to reduce duplication #!/bin/bash # Make script executable with: chmod u+x brew.sh # Ask for the administrator password upfront. sudo -v # Keep-alive: update existing `sudo` time stamp until the script has finished. while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & # Create '.other'-folder echo "--> ...


1

First: What do you need it for? Wouldn't sshfs do the job better? Your problem is the opposite. The server offers old (and possibly broken) KeyExchange methods: diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1, that are no longer default in current version of openssh server (what is that server? If your sysadmin tells you that it is strict and ...


0

I decided to try and start the .lnk file directly by opening the DOS Prompt from the wine menu with the com.xilinx.verilog prefix set. After navigating to C:\users\Public\Desktop I ran start "ISE Design Suite 14.7.lnk" and it opened the application window! I'm currently looking for a nicer way to run it, but I'm excited to have it working without needing to ...


0

The linked answer gave me a good start, but was a bit simplistic - it triggered if you had a glob matching 3 files, but not if you were doing rm -rf foo. So this works for me in ~.bash_profile: rmf() { if [ "$1" == "-rf" ]; then read -r -p "Sure you want to delete '${2}' [y/N]? " response if [[ $response =~ ^(yes|y| ) ]]; then ...


2

Being unable to change permissions as root on a built-in application or system file on OS X is indicative of System Integrity Protection, a new security feature added in 10.11, which restricts the root account and limits the actions that the root user can perform on protected parts of OS X. Protected parts include /System and pre-installed ...


-2

You should be able to achieve your desired results as the root user on Mac OS X prior to 10.11 "El Capitan". "The user account named "root" is a special user in UNIX-style operating systems that has read and write privileges to all areas of the file system." If you have not already enabled the root user, here are the instructions on how to enable ...


3

Your problem comes from the ping command that never exits. You should make a loop that call ping for one test -c 1: while [ true ] ; do if ping -c 1 www.google.com | grep timeout ; then say fail ; fi ; sleep 1 ; done edit I wrote a bash while loop, may be you should adapt it to your shell program (It's been a long time I play with mac os X), I added ...


0

@Michael Homer answered my question. The code is: sudo chmod a-x /Applications/'Whatever Application' The code works perfectly and the Application cannot be opened.


5

It's an interesting behavior you've noticed there. It's wrong to classify it as a "bug" because POSIX doesn't specify a -o option for grep. You may not like how it behaves, and I'll agree that it's annoying that BSD and GNU grep differ, but this behavior is not actually in conflict with what the BSD manual pages say. If you still say it's a bug, well, you ...


1

Locking scheme used for directory operations is based on two kinds of locks - per-inode (->i_mutex) and per-filesystem (->s_vfs_rename_mutex). When taking the i_mutex on multiple non-directory objects, we always acquire the locks in order by increasing address. We'll call that "inode pointer" order in the following. For our purposes all operations fall in ...


0

Since you do not specify if you are using OS X Server or not, let me presume not and suggest that you might be violating the EULA: 2H. Remote Desktop Connections. Subject to the terms and conditions of this License, when remotely connecting from another computer or electronic device (each a “Device”) to an Apple- branded computer that is running ...


0

I'm surprised no one suggested the very simple solution of: sed -i.bak -E 's/\\\t/ /' file.txt That should do the trick. You need to escape the escape (hence the 3 \s) to allow sed to understand that you are trying to use a \t character in the regular expression when everything is substituted...


4

OS X in itself is a multi-tasking, multi-user OS, but VNC is desktop control software, so software that controls 1 desktop (unless set up in such a way that multiple virtual desktops can be controlled remotely). So what you're seeing is standard behaviour of the software you're using, not of the underlying OS... ;-)


0

Two typos: [ $j -eq $RANDOMNUMBER ] should be [[ $j -eq $RANDNUMBER ]] It seems to work after making the corrections.


1

A common way to shuffle a list is to loop over the elements and swap with another element at random. #! /bin/bash - list=(1 2 3 4 5 6 7 8 9 0) random_list=("${list[@]}") n=${#random_list[@]} for ((i = 0; i < n; i++)); do (( r = RANDOM % n )) tmp=${random_list[i]} random_list[i]=${random_list[r]} random_list[r]=$tmp done printf '%s\n' ...


2

You can download the installer from https://www.python.org/downloads/release/python-2711/ and install it as usual: sudo installer -src /path/to/python.pkg -tgt / Alternately, you can use a Linux/BSD -like package manager, like Homebrew and install python from it: brew update brew install python


1

You should umount by the directory name , not the device name. man umount: The umount command detaches the mentioned file system(s) from the file hierarchy. A file system is specified by giving the directory where it has been mounted. Giving the special device on which the file system lives may also work, but is obsolete, mainly because it will ...


0

Seems like there is no real alternative to the gnu time command. So, in the end I installed just that. On OS X gnu-time can be installed with homebrew: brew install gnu-time. Thereafter CPU utilization for a specific command can be measured using gtime <command>. A test shows that my program is indeed running concurrently: 1.73user 0.13system ...


2

Regarding to above input examples the script can be: sed s/[^\"\']*[^0-9]\]{\(.*\)}/\1/ <<\END "[]{foo bar 1}" "[abc]{foo bar 2}" "[]{foo[3]{xyz} bar 3}" "[]{foo $sq[3]{xyz}$ bar 4}" "[goo{w}]{foo $sq[3]{xyz}$ bar 5}" "[goo[3]{w}]{foo $sq[3]{xyz}$ bar 6}" "[goo[3]{w} hoo[3]{5}]{foo $sq[3]{xyz}$ bar 7}" END produces "foo bar 1" "foo bar 2" ...


0

As of coreutils v8.24, dd has native support for showing progress. Just add the option status=progress. Example: dd if=arch.iso of=/dev/sdb bs=4M status=progress Source


1

With POSIX shell: min() { min=$1 shift for arg do min=$((arg<min?arg:min)) done printf '%s\n' "$min" } All shells but zsh, ksh and yash do not support float numbers. With POSIX toolchest: min() { awk 'BEGIN { min = ARGV[1] for(i = 2; i < ARGC; i++) min = ARGV[i] < min ? ARGV[i] : min print min }' "$@" } And ...


-1

Push your data to a file, then sort them up and get the first line. #/bin/sh echo $VAR1 > $FILE echo $VAR2 >> $FILE echo $VAR3 >> $FILE RET=$(sort -n $FILE | sort -n)


0

The arrow keys are being defined in your termcap(5) as escape sequences. This is the default VT100 setting. You can see the sequence in a terminal with: ^v followed by whatever. Right arrow in VT100 parlance is ^[[C (^[) is escape. Notice this tells vi(1) to exit insert, move up a paragraph (none or one line in this case, apparently), and change to end ...


0

If you don't care about the original data continuing to exist, and you just want to delete files that you can't delete directly due to character encoding issues then this is your solution. It involves using rename to rename the files so they may be deleted. The example below will remove all NON-ASCII characters from all file and directory names in the ...


0

OSX "vi" appears to be vim. Its version message says (for El Capitan): VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Oct 27 2015 16:22:14) Compiled by root@apple.com Normal version without GUI. Features included (+) or not (-): There is a remote chance that you are not using vim, but no one has offered a plausible alternative. vim accepts cursor-key ...


0

You can use vim which is improved,and can use the arrow keys,vi as default use keys h j k l to move the cursor If vi is aliased to vim,check with alias vi So edit $HOME/.vimrc and put in this line set nocompatible If interested on unix i usually use this vimrc set nocompatible set backspace=indent,eol,start syntax on imap <esc>OH <esc>0i ...


2

Editing a disk image is possible, but very risky. If you have a suitable editor that can help you with this it would be worth making sure that you have a copy (written or otherwise) of the data you're changing. Most importantly, it must not be attempted without the disk being unmounted and not in use. If it's your boot/system disk that means you are going ...


3

For appending, all you need do is get rid of the extra quotes, e.g., change CONVERTPATH="$(pwd $PATH)" "/" "$(basename $PATH)" to CONVERTPATH="$(pwd $PATH)/$(basename $PATH)" But there are a few problems: pwd does not take an argument; you can use dirname in the case presented. the read command will not set PATH; rename it, e.g., to name the echo ...


-1

Have you tried simply renaming the folder to something else then deleting it? A method that has worked for me was to live boot into a Linux environment via CD/USB, dismount the drive with the 'odd' named directory/file, THEN deleting it. This method works most of the time, not every, for me.


0

Type control-b followed by the modified key (release the control and the b before you type the modified key). The Apple/command key does nothing within a normal terminal session nor does Raspian recognize the key (and the fact that it is pressed is probably not even transmitted over the ssh connection). tmux requires the control key as a modifier unless you ...


4

NetBSD has documentation here: Part V. Building the system You might be able to compile a NetBSD kernel on OSX. At a minimum, you would need the kernel source tree, i.e., /sys (which at least does not conflict with OSX's system directories). whatever tools are needed, you probably have to download source and compile those. build.sh is only a small part ...


1

You can get rid of your problem by making the following edit to your script: echo -n ${LOWER[$RANDLOWER]}${UPPER[$RANDUPPER]}${SYMBOL[$RANDSYMBOL]}${NUMBER[$RANDNUMBER]} done >> passwords.txt echo >> passwords.txt done For me, it is giving sample output as expected: $ cat passwords.txt dI)9oF*5mG(1 pO&9rL%7cO^9 vB#8zF^4uN)3 hW(5dA%0sT^4 ...



Top 50 recent answers are included