pngcrush: uncrush on linux? [closed] - ios

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Apple's iOS SDK use a modified version of pngcrush for converting png files in iOS bundles.
Their version can also revert the changes (using the "-revert-iphone-optimizations" switch), but the original version can't.
Is there a tool that can be run on Linux and revert the iphone optimizations?
Thanks.

iphone-fixpng works in Linux. See this discussion explaining what it does. I'm linking to web.archive.org because the original is down.

You can choose to use one of this:
Install Hackintosh inside linux, with VirtualBox. install Xcode inside it, then do something like this
$ /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush -dir uncrushed -revert-iphone-optimizations -q *.png
This uses a modified pngcrush from apple to undo its optimizations. Guess this will work with all crushed pngs. See this for more accurated command xcrun
Download iPIN.py from this blog and execute as
$ python ipin.py
This will uncrush all files from actual directory and its subdirectories. Don't worry about call it twice, from my experience does not corrupt already uncrushed pngs. From here you will find that ipin.py does not deoptimize all apple pngs
It (ipin.py) cannot handle multiple IDAT chunks, does not work with Adam7 interlaced images, and does not fix pre-multiplied alpha.
Use an specific gnome binary tool. This needs a few low level steps:
$ git clone https://github.com/hadess/fixpng-thumbnailer.git
$ cd fixpng-thumbnailer
$ ./autogen.sh
$ make
$ sudo make install
After that, you have available a new command gnome-fixpng-thumbnailer which works like this
$ gnome-fixpng-thumbnailer [INPUT FILE] [OUTPUT FILE]
Take care with this command, because it corrupts pngs if is called twice on same png.
I use it this way:
$ for file in *.png; do echo " $file";gnome-fixpng-thumbnailer $file $file; done
You will guess why echoed the filename. Thats because this command could fail silently, (no $? with nonzero if fails) and the only clue you will have is a "ZLib error! -3" message. It's a quick solution because funnily enough you will find ipin.py does uncrush those files.
Read this for yet another tool around pngdefry. It provides an invaluable info about all this stuff -even its source- but I haven't tried myself.
My hope is in pngcrush absorbs those functionality so you have it out of the box, at least I have send a mail to pngcrush maintainer (hi Glenn).

Related

Why VI always starts in insert mode?

At some point, whenever I use vi from the command line (windows 10/WSL) it starts up in insert mode, meaning that everything I usually do to navigate ends up adding stuff to the file, wasting time having to clean it up.
I didn't have a vimrc file, and there doesn't seem to be anything in my bash rc files to modify vi behavior. Any ideas what I may have done or any ideas how to stop this behavior? I'm using Ubuntu-20.04
FWIW, adding a .vimrc file with tab related settings didn't change it's behavior. I looked at the /etc/vimrc file, and nothing inside it seemed relevant.
After plowing through google search and trying everything I understand about configuring 'vim' and doing comparison tests, I think:
This behavior is specific to Windows Terminal when opening a WSL terminal. Using WSL's "native" terminal (i.e., clicking the "Ubuntu 20.04 LTS" menu in the "Start" menu) doesn't have this problem.
My original motivation for switching to Windows Terminal is for its multi-tab feature. But this new behavior is crazy -- it works against years of my muscle memory of using "vi", and I'm almost certain that one day I'll accidentally update some configuration file while reading it in "vi". And, I cannot re-train a new muscle memory because all the rest of the UNIX world (e.g., when I SSH into a remote server) hasn't changed. This is like constantly switching between a Mac keyboard and a PC keyboard where the Ctrl key, etc., are in different places.
My solution: I switched to MobaXterm. It has multi-tab support, and is actually richer in features compared to Windows Terminal.
Please run the following:
alias | grep vim
sudo find / -name .vimrc 2>/dev/null
These commands should show you all the places to check, change the alias or fix the .vimrc files found.
Do you find it always going into edit mode, when you vim a file directly and when you use vim as the git commit editor for example?
EDIT:
You could also try which -a vim or whereis vim to see if you have multiple versions. Or failing that sudo find / -name vim 2>/dev/null
here is a better solution. I downloaded the binary.
https://github.com/lxhillwind/vim-bin/releases/tag/v9.0.0978
Put the vim command in /usr/bin/vi
Put the runtime in:
/usr/local/share/vim/runtim
sudo apt remove vim vim-common vim-runtime vim-tiny
sudo apt purge vim vim-common vim-doc vim-runtime vim-tiny
The second line actually gets rid of residual-defaults.
There is also a defaults.vim someplace on the system. I just nuked it.
I went through and made sure there were no aliases or vi or vim configuration files, but still no luck.
This is a horrible solution, but the only thing that is keeping my sanity right now.
vi -c ":imap jj "
You can alias it in your .bashrc. Looking into better solutions.

Google Coral : hide kernel boot messages [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
How to hide kernel boot message on the Google Coral ?
# cat /etc/debian_version
10.0
but i can't find the grub file (i tried, like for debian, /etc/default/grub ... nothing) to edit and add "quiet" (like for a regular Ubuntu/Debian), then regenerate grub :(
embeded linux usually uses uboot instead of grub as it is too large. Specifics on how to customizing kernel should take more researches, however, you can add loglevel=0 to the kernel command line to eliminate some kernel messages.
Download boot.txt:
$ curl https://coral.googlesource.com/uboot-imx-debian/+/refs/heads/master/debian/boot.txt\?format\=TEXT | base64 --decode | tee boot.txt > /dev/null
Install mkimage:
$ sudo apt install u-boot-tools
Make your necessary changes in the cmdline="" line, for this example, we need to add "quiet loglevel=0":
cmdline=<preexsisting> + quiet loglevel=0
compile to boot.scr:
$ mkimage -A arm -T script -O linux -d boot.txt boot.scr
replace old boot image file
$ mv boot.scr > /boot
Reboot and the new kernel params should be loaded.
share edit delete flag

Installing "en_US" in RHEL container [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I'm testing an ansible role using molecule. The role install a corporate binary over which I've no insight, I'm just mean to ./binary --silent and that's it. Over RedHat.
It work for a RedHat 6.9 VM. But it doesn't work over the docker container registry.access.redhat.com/rhel6:6.9.
The error message says:
"Operating system bad language (en_US not found)".
What could be missing from the container that would be on the VM? Some localedef ...? I wasn't able to find a doc about this, but is there some RedHat description about the delta between their "minimal install from ISO" VMs and containers?
Thanks for any help
If you run locale -a on the Docker image you're using, you'll get the following output:
C
en_US.utf8
POSIX
Run the same command in your VM and compare output. If it contains line en_US (without utf-8 suffix), try adding the following lines dicrectly below FROM directive in your Dockerfile:
RUN localedef -v -c -i en_US -f UTF-8 en_US; exit 0
RUN sed -i 's/en_US.UTF-8/en_US/g' /etc/sysconfig/i18n && source /etc/sysconfig/i18n
This will generate locale en_US with encoding UTF-8 named en_US (without any suffix).

Is there a startup file (like .bashrc) for i3 where i can set environmet variables? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
It would help me to setup my system-wide proxy. I'm using latest Ubuntu and tried /etc/X11/xinit/xinitrc ~/.xinitrc and ~/.xsession,
export HTTP_PROXY=http://....
But that did not work.
Apparently i3 uses sh to launch stuff, and does not source $PATH from ~/.bashrc :
cat ~/.xsession-errors
(...)
/bin/sh: 1: mycommand: not found
So, just create a ~/.xsessionrc file and put your statements in it :
export HTTP_PROXY=http://....
Then logout and back in ; It should work now.
System-wide environment can be setup by placing a script in /etc/profile.d/
For example, you may create /etc/profile.d/proxy with your
export HTTP_PROXY=http:// # enter your proxy settings here
Then chmod +x this file, then reboot :
chmod +x /etc/profile.d/proxy
systemctl reboot
After reopening your session you could check the variables are there :
env | grep HTTP
You should see the variables set with the values you entered in the profile script.
In order to set system wide proxy settings you can add the following:
export http_proxy='http://172.27.100.5:4444/'
export https_proxy='http://172.27.100.5:4444/'
export ftp_proxy='http://172.27.100.5:4444/'
export no_proxy='localhost,127.0.0.0/8,::1
to your bash.bashrc file which is located in /etc folder. Of course, you should replace addresses with your ones. It works at least for Debian.

Avoiding the creation of .aux, .log and .synctex.gz files when using pdflatex [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I just want to have a .tex file which I compile with pdflatex and end up with a .pdf file. I don't want all the other .aux, .log and .synctex.gz files. pdflatex doesn't seem to have arguments for this.
latexmk -c will remove the unnecessary files. latexmk is a great way to manage the compile too!
I always build my PDF files like this:
pdflatex -aux-directory=/some/temp/dir <additional options>
That way, I don't have too see all the additional files. Those files should not be removed, as they are important for cross referencing, bibliographies, table of contents etc. To run pdflatex several times and then remove the files takes too much time.
The -aux-directory unfortunately does not exist in the linux version of pdflatex. Tested on Ubuntu Lucid.
For people on Linux the equivalent to -aux-directory appears to be -output-directory, unfortunately it doesn't play nicely with \include{...} (included files' .aux files still get dumped in the current directory).
See also: the man page.
If anyone using TeXnicCenter has the same desire to only get a *.pdf file for the given *.tex file (no *.aux, *.bbl, *.blg and *.log files), here is a quick solution:
Choose from the menu: Build | Define Output Profiles, copy the "LaTeX => PDF" profile to a new profile "LaTeX => PDF ONLY", then on the Postprocessor tab create four new postprocessors:
Name: delete *.XXX
Executable: "C:\WINDOWS\system32\cmd.exe"
Arguments: /C del "%bm.XXX"
Replace XXX with aux, bbl, blg, log, respectively.
For MikTeX:
texify -cp file.tex
It will run pdflatex as many times as necessairy and clean temp files afterwards. Very useful.
A well crafted wrapper script seems to be the best answer. Something along these lines, which I've tested on Ubuntu using texlive-latex (pdftex 1.40.10) :
#!/bin/bash
TMPDIR=$(mktemp -d)
trap "rm -fr $TMPDIR; exit 255;" SIGINT SIGTERM SIGKILL
/usr/bin/latex -interaction=batchmode -output-directory=$TMPDIR $1
cp $TMPDIR/$1.dvi .
rm -fr $TMPDIR
IIRC \nofiles in your file suppresses the .aux output.
Write a shell-script wrapper which removes the files:
#!/bin/sh
pdflatex "$#" && rm -f *.aux *.log *.synctex.gz
Bonus-assignment: modifying the script to only remove the files actually created by pdflatex.
How are you creating/editing your LaTex document? If you are using Sublime Text 2, you can edit the project file to suppress opening the file types of your choosing. They will still be created upon compile but won't be loaded into your project, keeping them invisible.
Use pdflatex with -enable-write18 option and write at the end of your LaTeX file
\write18{del *.aux}
\write18{del *.log}
\write18{del *.gz}
or more pricise
\write18{del \jobname.aux}
\write18{del \jobname.log}
\write18{del \jobname.synctex.gz}
\write18{del \jobname.toc}
\write18{del \jobname.loc}
del is a DOS-function. Use rm for UNIX.

Resources