pixelb / scripts Goto Github PK
View Code? Open in Web Editor NEWscripts from pixelbeat.org
Home Page: http://www.pixelbeat.org/scripts/
scripts from pixelbeat.org
Home Page: http://www.pixelbeat.org/scripts/
What's the license of ansi2html.sh?
https://github.com/pixelb/scripts/blob/master/scripts/ansi2html.sh
Hello.
The following patch changes the longopt variant of the -s switch to a more intuitive one and adds the -s switch to the help/usage.
http://jcapik.fedorapeople.org/files/ps_mem/patches/ps_mem-ennobling-the-s-switch.patch
Please, check and apply.
Thanks in advance.
Regards,
Jaromir.
Jaromir Capik
Red Hat Czech, s.r.o.
Software Engineer / Secondary Arch
Email: [email protected]
Web: www.cz.redhat.com
Red Hat Czech s.r.o., Purkynova 99/71, 612 45, Brno, Czech Republic
IC: 27690016
First of all, thank you very much for this wonderfull little program, then the issue :).
I am on Arch Linux. Recently I updated to linux 3.0 and ps_mem have not worked. I use a alias pointing to ps_mem.py which I renamed as mem.py. Here is the traceback:
Traceback (most recent call last):
File "/home/_/mem.py", line 124, in
kv=kernel_ver()
File "/home/_/mem.py", line 120, in kernel_ver
kv[2]=kv[2].split(char)[0]
IndexError: list index out of range
Hope it will be fixed soon. Thanks.
Sorry if there's a solution to this, but it seems that the colours in the HTML don't match the colours from the terminal?
I am trying to run ansi2html
on Debian 7.4, and awk
is giving the following errors:
...
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.blink { text-decoration: blink; }
</style>
</head>
<body class="f9 b9">
<pre>
awk: line 26: illegal reference to local variable a
awk: line 26: illegal reference to local variable a
awk: line 34: illegal reference to local variable a
awk: line 37: illegal reference to local variable a
awk: line 42: illegal reference to local variable a
</pre>
</body>
</html>
I guessed this was a problem caused by Debian's awk
(which is actually mawk
) vs. the GNU awk, so I installed gawk
and edited ansi2html.sh
to use gawk
intead of awk
. This worked.
It would be nice if something could be done similar to the fix below that would look for gawk
if it is available, and just falls back to awk
if it is not.
See the attached files the files in this Gist (because GitHub does not allow attachments to issues).
LC_ALL=en_US.UTF-8 ./ansi2html.sh < bug.txt > worksfine.html
LC_ALL=C ./ansi2html.sh < bug.txt > buggy.html
Reproduced on Linux Ubuntu 13 and 14.
Hi,
ps_mem.py is great, but one feature is missing: it doesn't count memory used as tmpfs. It would be nice to see if my /tmp uses more space than it should...
To repo:
Add to LS_COLORS:
.hushlogin=38;1;30;1
Regex replaces it to "*.husmh=" because of the regex that hl_no_color does
This example outputs red bash text using ANSI escape codes but ansi2html errors out when converting to html. Is this supported? Am I using the script wrong?
Output:
echo -e "\e[0;31mTEST\e[0m" | ansi2html.sh -p
gawk: cmd. line:25: (FILENAME=- FNR=1) fatal: attempt to use array
a (from span)' in a scalar context`
Hi dude,
saw your post on reddit, very cool.
About the proc global variable, Instead of open(proc+sth).read()
everytime, why not invent a function called read_procfs() ?
Thanks!
I've found a problem with this version when run whith Python 3.2.1.
The problem is the next:
File "./ps_mem.py", line 133
except (IOError, OSError) value:
^
SyntaxError: invalid syntax
I corrected this with change the , with as
Given the git diff file below, ansi2html (the newest version pulled straight from the repo) will generate output that stops midway thru the file.
Given that the "á" shows up in the output as a "�" I suspect that this is somehow matters.
The HTML stops on this line:
informe. Una agencia investigadora de informes de crédito deber�°
========= Input file =======================
�[1mdiff --git a/classes/screening/report/ui.class.php b/classes/screening/report/ui.class.php�[m
�[1mindex 3476082..7fbb43d 100755�[m
�[1m--- a/classes/screening/report/ui.class.php�[m
�[1m+++ b/classes/screening/report/ui.class.php�[m
�[36m@@ -319,6 +319,14 @@�[m �[mclass screening_Report_UI�[m
}�[m
break;�[m
�[m
�[32m+�[m�[32m // Decide what version of the California disclaimer to use on pur printer friendly forms.�[m
�[32m+�[m�[32m case REPORT_COMPONENT_PRINTER_FRIENDLY_HEADER:�[m
�[32m+�[m�[32m $eligReleaseV2 = Params::get('screening', 'report_component_printer_friendly_header.release.v2');�[m
�[32m+�[m�[32m if ($eligReleaseV2 <= $createTime) {�[m
�[32m+�[m�[32m $renderVersion = 2;�[m
�[32m+�[m�[32m }�[m
�[32m+�[m�[32m break;�[m
�[32m+�[m
case REPORT_COMPONENT_PHYSICAL_CRIMINAL_SEX_OFFENDER:�[m
case REPORT_COMPONENT_TALENTSHIELD_PHYSICAL_CRIMINAL_SEX_OFFENDER:�[m
case REPORT_COMPONENT_PHYSICAL_CRIMINAL_NATIONWIDE_DB:�[m
�[1mdiff --git a/core/inc/defines.inc.php b/core/inc/defines.inc.php�[m
�[1mindex a703c53..5082859 100755�[m
�[1m--- a/core/inc/defines.inc.php�[m
�[1m+++ b/core/inc/defines.inc.php�[m
�[36m@@ -195,8 +195,9 @@�[m �[mdefine ("REPORTYPE_CONSUMER_DMV", "57"); //Consumer Driving Report�[m
// NOTE::::::::::::::: PLEASE DO NOT ADD ANY REPORT TYPE WITHOUT TALKING TO NIRAJ�[m
�[m
/*******************************************************************_**/�[m
�[31m-//Defines the possible ReportComponents�[m
�[31m-//DO NOT CHANGE THE DEFINE NUMBERS ONCE THEY HAVE BEEN USED IN PRODUCTION�[m
�[32m+�[m�[32m// Defines the possible ReportComponents�[m
�[32m+�[m�[32m// DO NOT CHANGE THE DEFINE NUMBERS ONCE THEY HAVE BEEN USED IN PRODUCTION�[m
�[32m+�[m�[32m// Kept in Intelius.Packages.ReportComponents (| separated list, search for LIKE %value%)�[m
define ("REPORT_COMPONENT_NONE", "0");�[m
define ("REPORT_COMPONENT_SUMMARY", "1");�[m
define ("REPORT_COMPONENT_PROPERTY", "7");�[m
�[36m@@ -287,6 +288,7 @@�[m �[mdefine ("REPORT_COMPONENT_PHYSICAL_CRIMINAL_1_STATE", "96"); // Like 110 (natcri�[m
define ("REPORT_COMPONENT_ISERVICES_SEX_OFFENDER", "97");�[m
define ("REPORT_COMPONENT_PHYSICAL_CIVILCOUNTY", "98");�[m
define ("REPORT_COMPONENT_SOCIAL_NET_SUMMARY", "99");�[m
�[32m+�[m�[32mdefine ("REPORT_COMPONENT_PRINTER_FRIENDLY_HEADER", "100");�[m
define ("REPORT_COMPONENT_PHYSICAL_PHYSICAL_EXAM", "101"); // Physical Physical -- I meant to do that�[m
define ("REPORT_COMPONENT_PHYSICAL_ESCREEN_DRUG_SCREEN", "102");�[m
define ("REPORT_COMPONENT_INCART_ACCEPTANCE_MARKETING", "103");�[m
�[1mdiff --git a/core/inc/uberreport.inc.php b/core/inc/uberreport.inc.php�[m
�[1mold mode 100644�[m
�[1mnew mode 100755�[m
�[1mindex 36f768f..202d377�[m
�[1m--- a/core/inc/uberreport.inc.php�[m
�[1m+++ b/core/inc/uberreport.inc.php�[m
�[36m@@ -173,6 +173,9 @@�[m �[mclass UberReport�[m
public function DisplayUberReport($Owner, $GetUserObject, $applicantId, $isPrinterFriendlyPage = 0, $echoOut = TRUE)�[m
{�[m
global $SiteConfigCore;�[m
�[32m+�[m
�[32m+�[m�[32m // guarantee the define of the theme class.�[m
�[32m+�[m�[32m require_once('inc/template.inc.php');�[m
theme::factory()->addDir('screening/tpl'); // In case we don't have it yet�[m
�[m
// ReportContext supersedes isPrinterFriendlyPage�[m
�[36m@@ -971,18 +974,57 @@�[m �[mclass UberReport�[m
$includeFCRA = false;�[m
}�[m
�[m
�[31m- $civilCode = '';�[m
�[31m- if ($includeFCRA){�[m
�[31m- // for internation uberform, we do not show Civil code nor FCRA�[m
�[31m- $civilCode = 'Per California Civil Code 1786, ';�[m
�[32m+�[m�[32m // figure out what render version to use.�[m
�[32m+�[m�[32m $FakeReqProfile = array(�[m
�[32m+�[m�[32m 'App' => REPORT_COMPONENT_PRINTER_FRIENDLY_HEADER,�[m
�[32m+�[m�[32m 'CreateTime' => $this->m_CreateTime,�[m
�[32m+�[m�[32m );�[m
�[32m+�[m�[32m $FakeReportData = array();�[m
�[32m+�[m�[32m $renderVersion = screening_Report_UI::getRenderVersion($FakeReqProfile, $FakeReportData, $this->m_ReportContext);�[m
�[32m+�[m
�[32m+�[m�[32m if ($renderVersion === 1) {�[m
�[32m+�[m�[32m $civilCode = '';�[m
�[32m+�[m�[32m if ($includeFCRA){�[m
�[32m+�[m�[32m // for internation uberform, we do not show Civil code nor FCRA�[m
�[32m+�[m�[32m $civilCode = 'Per California Civil Code 1786, ';�[m
�[32m+�[m�[32m }�[m
�[32m+�[m
�[32m+�[m�[32m // 12pt font is a legal requirement that presumably applies to Web as well as print�[m
�[32m+�[m�[32m $legalTopHtml = '
Thank you so much for ansi2html.sh :-) I'm using it to provide summaries of git-tracked changes to document reviewers who don't use git themselves.
For that purpose, I'd like to learn how the script could insert line-breaks after a certain number of characters. Thanks for any hints!
0.99.11 script. While athlon-4 and athlon-xp may mean the same thing to GCC (?), I am wondering why not use /proc/cpuinfo to disambiguate. The rig is not a VM but straight hardware. Close ticket if not a real issue. Thanks.
$ grep "model name" /proc/cpuinfo | cut -d ':' -f 2
AMD Athlon(tm) XP 3000+
$ uname --kernel-name --kernel-release
Linux 3.14.0-4-ARCH
$ gcccpuopt
Warning: Your compiler supports the -march=native option which you may prefer
-march=athlon-4 -mfpmath=sse
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.8.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /build/gcc/src/gcc-4.8-20140206/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-cloog-backend=isl --disable-cloog-version-check --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --disable-multilib --disable-werror --enable-checking=release
Thread model: posix
gcc version 4.8.2 20140206 (prerelease) (GCC)
I think it will be useful if we have the CLI Option to enable and disable word wrap, as certain outputs have very long lines.
Refer: css - How to word wrap text in HTML? - Stack Overflow
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.